Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
Mario Malic
Mario Malic el 20 de Dic. de 2023
Editada: Mario Malic el 20 de Dic. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by