Azzera filtri
Azzera filtri

How can I set the destination directory for a created report using report generator in a compiled app?

1 visualizzazione (ultimi 30 giorni)
I have a compiled app that uses Report Generator to output report pages. The code runs well in the Matlab environment, but in the compiled app, the user must run as admin to have write permission to Program Files (where the app is installed). I'm using the document command as shown in the code below.
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
%user enters file name in dialogue window
prompt = {'Enter File Name:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {''};
Filename = inputdlg(prompt,dlgtitle,dims,definput);
Filename = string(Filename);
%user selects appropriate template file
[templatename, pathname] = uigetfile({'*.dotx'}, 'File Selector');
template = strcat(pathname, templatename);
% output document is created - trying to modify the code below
% to allow the user to select the directory where this file is
% created
D = Document(Filename,'docx', template);
The user inputs a file name via a dialogue box, selects the appropriate template file, and the document command creates the output file. My end users will not be able to run as admin. Is there a way to set (or have users input/select) the directory to create the output report in a directory where they'll have write permission?
  3 Commenti
Mario Malic
Mario Malic il 20 Dic 2023
Modificato: Mario Malic il 20 Dic 2023
I would suggest to write the data within the TEMP or HOME environment variable, you will have write permissions there. Above works as well.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by