フィルターのクリア

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

1 回表示 (過去 30 日間)
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 件のコメント
Mario Malic
Mario Malic 2023 年 12 月 20 日
編集済み: Mario Malic 2023 年 12 月 20 日
I would suggest to write the data within the TEMP or HOME environment variable, you will have write permissions there. Above works as well.
RGB85
RGB85 2023 年 12 月 20 日
This approach works. Thank you both for your help!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by