Report generator issue on standalone application

조회 수: 25 (최근 30일)
Danilo Teran
Danilo Teran 2017년 7월 6일
댓글: RGB85 2023년 12월 15일
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

답변 (2개)

Vijay A
Vijay A 2020년 1월 25일
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
Sreejith Themath
Sreejith Themath 2020년 5월 16일
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 2020년 5월 22일
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

댓글을 달려면 로그인하십시오.


Vijay A
Vijay A 2020년 1월 21일
Have you figured out this issue plesae inbox me
  댓글 수: 4
Adam Danz
Adam Danz 2020년 12월 18일
@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 2023년 12월 15일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by