Making a report template refer to a file within the project

I’m able to create a beautiful report using a microsoft word .docx file template. I have saved the .docx template file to a folder within the program files and I would like to hard-code that template as the destination template when the report is run.

How can I make sure that template file is always called when any user runs a report. Where do I put the path?

Hi Ned,

sorry, I’m a little confused. If you set your report template as default template for the report in Cuba report editor then any user who runs the report will be using the template you’ve set. Default template is being saved in the database when you upload it in report editor.

I dont get what you mean by destination template. You mean destination output document? The file, produced by running the report? You want to save it to specific path without raising browser save file dialog and to make that path hardcoded for all the users?

I won’t be the one using this product, and I’m not sure what permissions will be given to whom when it’s done. I just don’t want them calling me back and saying “Oops. We changed or removed the report template in the database and don’t have access to the original file! Could you re-upload that into the database for us?”
So, I was hoping there might be a more permanent way to set up the template and call it in the code, and not just as a file upload.

What I want permanent access to a word file that is a template that can be used for generating reports. The normal way to upload is shown in the image. I’m just looking for another way.

If it’s not possible, that’s ok. There are other reasonable solutions.

template editor

Well, technically it is possible, you can look into ReportService, which generates documents based on report and template code.

I would suggest doing that by the means of Cuba security subsystem though. You can restrict editing reports for anyone but the users with Administrators role. I assume you have default role, other then “Administrators”.
You can restrict editing reports via Administration -> Roles -> user roles -> Screens -> scroll down to Other Screens -> report$Report.edit screen -> check deny on the right and click OK.

This will make users not able to edit any reports from the UI.

Concerning Administrators role - you have to trust them to some extent, because there are other ways how they can mess up with the system via Administrators menu.

There are other ways to prevent removing templates exist. You could bind running report to a button and remove the whole Reports menu from the system, for instance. Please comment if suggested solutions don’t work for you.