- Perhaps the easiest way to convert DOCX to PDF is to use the "docview" function, which has options to convert from DOCX to PDF. See the following documentation page for an example: https://www.mathworks.com/help/releases/R2023a/rptgen/ug/docview.html#bveyudd-1
- Another option is to manually create the DOCX files from the DOTX template and use Microsoft Word's built-in export tool for the last step. Specifically, after having created the DOCX file from the DOTX template, open the DOCX file in Microsoft Word and select "File > Export > Create PDF/XPS Document" from the Microsoft Word ribbon/sidebar.
How do I generate a PDF report from a Microsoft Word Template using MATLAB Report Generator R2023a?
16 ビュー (過去 30 日間)
古いコメントを表示
Stefano Bertuletti
2019 年 4 月 5 日
回答済み: MathWorks Support Team
2023 年 8 月 10 日
How can i generate a PDF report from Word Template?
I am able to create Word Report from a Word Template as follows:
d = Document('myReport','docx','Template.dotx');
open(d);
close(d);
How can I convert/generate it as a PDF file?
0 件のコメント
採用された回答
MathWorks Support Team
2023 年 8 月 9 日
There are a couple ways to accomplish this goal. In both of them, we recommend creating a DOCX file from the DOTX template as the first step, which may be accomplished programmatically with MATLAB Report Generator or manually in Microsoft Word. The DOCX can then be converted to PDF in a couple different ways. Note that each of these methods assumes that Microsoft Word or a Word-compatible editor is installed.
0 件のコメント
その他の回答 (3 件)
Sebastian Balthes
2020 年 4 月 22 日
Is there any other solution for this problem so far ?
I also wanna do it programmatically without running report explorer, because I need it for a standalone application.
0 件のコメント
Dominic Jarecki
2020 年 6 月 16 日
編集済み: Dominic Jarecki
2020 年 6 月 16 日
If you add the code:
rptview(d.OutputPath, 'pdf');
it will convert the .docx file to a .pdf. (Thus, you can proceed programatically as .dotx -> .docx -> .pdf, even in a deployed application.)
Unfortunately, this will also display the .pdf file as it is created, which may not be the intended behavior for a deployed application. I will update this post later if I find a way to hide the .pdf as it being created.
UPDATE: Turns out if you use docview(), you can avoid having anything display when you convert from .docx to .pdf:
docview('whateverYourFileHappensToBeNamed.docx','convertdocxtopdf','closeapp');
It is possible that this will not work on Linux (and maybe Mac); in any case, I haven't tested in those environments.
0 件のコメント
Dhanashree Mohite
2019 年 4 月 8 日
You can use report explorer to generate report for word document.
Use below command to open report explorer for that file:
>> setedit(filename)
refer below link for further steps:
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!