Report Generator cannot open custom template

Hello! I am trying to create a report using Report Generator, but I am getting this error message when running my code:
Error using mlreportgen.dom.Document/open
Cannot open file: Could not open source package
The code that results in this error is the following:
D = Document('FromTemplate','docx','MyTemplate.dotx')
open(D)
The error occurs on the line with the open(D) function. MyTemplate.dotx is a template file that I created on Word and it is located in the same folder as my script.
The code does work, however, if I add the line shown below before the problematic code, but then the resulting file is blank because it creates blank template.
Document.createTemplate('MyTemplate','docx');
I'm surprised that I couldn't find an answer to this question already on the forum, so please let me know if you have any insight as to what I can do to resolve the error. Thanks!

回答 (1 件)

Rahin Vadsariya
Rahin Vadsariya 2022 年 7 月 5 日

0 投票

Hello,
Please contact MathWorks Technical Support: https://www.mathworks.com/support/contact_us.html .
This issue might be happening only for some specific case. Support can ask you for files and diagnose further.

1 件のコメント

Diamantino
Diamantino 2025 年 7 月 9 日
I am actually having the same problem, was there a working solution?

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB Report Generator についてさらに検索

製品

リリース

R2018a

質問済み:

2022 年 6 月 14 日

コメント済み:

2025 年 7 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by