Report generator issue on standalone application

21 Ansichten (letzte 30 Tage)
Danilo Teran
Danilo Teran am 6 Jul. 2017
Kommentiert: RGB85 am 15 Dez. 2023
I am having a big problem. When I use the following line:
report = Document(docname,'html-file');
or
report = Document(docname,'docx');
on workspace it works well, then I compile this gui to a standalone application and I run .exe, but this .exe(standalone application) always fails there.
I really do not know how to correct it, because using matlab it works well and I need to use it on another computer without matlab.
Thanks

Antworten (2)

Vijay A
Vijay A am 25 Jan. 2020
Hello Danilo Teran
Initially i had the same problem, you must use the following code to rectify the issue :
  1. Using makeDOMCompilable()
Use the makeDOMCompilable() function in the begning of the program where you need to generate the report.
makeDOMCompilable();
import mlreportgen.dom.*
import mlreportgen.report.*
d = Document("mydoc",'pdf');
open(d);
2. Make sure you have the corresponding version of the matlab runtime installed in your PC.
In order to find the version of your matlab just type ver in your command prompt to check for your matlab version
code to find the matlab version is given below
ver
Click on the link below to move to the download section of the respective MATLAB runtime
Make sure the MATLAB Runtime is installed in the PC where you are using the exe standalone application and you need to install the same version of the MATLAB Runtime where the matlab codes are generated.
3. First compile a simple application without any external arguments to check :
makeDOMCompilable();
import mlreportgen.dom.*
import mlreportgen.report.*
d = Document("myDoc1", "pdf");
open(d);
append(d, Heading1("Spacing Using OuterMargin"));
p1 = Paragraph("This is a paragraph with a bottom outer margin of 50pt.");
p1.Style = {OuterMargin("0pt", "0pt","0pt","50pt")};
append(d, p1);
p2 = Paragraph("This is a paragraph with a bottom outer margin of 25pt.");
p2.Style = {OuterMargin("0pt", "0pt","0pt","25pt")};
append(d, p2);
p3 = Paragraph("This is a paragraph with a bottom outer margin of 5pt.");
p3.Style = {OuterMargin("0pt", "0pt","0pt","5pt")};
append(d, p3);
append(d, Text("Text to show spacing"));
close(d);
rptview(d);
4. If the above method does not work just text me or inbox me will give you another solution. I have face issues like this initially but now i resolved the issue.
Good luck
  2 Kommentare
Sreejith Themath
Sreejith Themath am 16 Mai 2020
I request your support:
I have written some code for my project work.
When I am Running from Matlab environemt Its woking fine. However when I make a standaloe app ots showing the following error
Error using mlreportgen.ppt.Presentation/add
Unable to check out a Report Generator license. Reason: ''
I checked and confirmed that I have valid Report generator license.
I have written makeDOMCompilable(); on top of my code.
I have installed the lattest matlab run time.
Can you help me to debug this issue.
makeDOMCompilable();
import mlreportgen.ppt.*
slidesFile = basic.pptname;
slides = Presentation(slidesFile,'Template.pptx');
slide_no=1;
para = Paragraph("Base data");
data= Paragraph(data_txt);
slide(slide_no) = add(slides,'Content');
replace(slide(slide_no),'Title',para);
replace(slide(slide_no),'Content',data);
close(slides);
Rahul Singhal
Rahul Singhal am 22 Mai 2020
Hi Sreejith,
To compile a PPT API program, you will have to use makePPTCompilable() instead. See https://www.mathworks.com/help/rptgen/ug/compile-a-presentation-program.html
Thanks,
Rahul

Melden Sie sich an, um zu kommentieren.


Vijay A
Vijay A am 21 Jan. 2020
Have you figured out this issue plesae inbox me
  4 Kommentare
Adam Danz
Adam Danz am 18 Dez. 2020
@Jorge Torres, are you getting an error message? If so, please provide the full message.
If you aren't getting an error message, could you describe the problem with the commented section?
RGB85
RGB85 am 15 Dez. 2023
I know this post is a few years old, but I'm having the same problem. I copied the code for the simple application above, compiled it, and the resulting app would not generate the report. I'm using a similar approach in one of my apps which is how I found this thread. As far as I can tell, the document command does not work in a compiled app. Is there any solution to this issue?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by