Error in Report Generator

11 ビュー (過去 30 日間)
Jana Pecke
Jana Pecke 2020 年 10 月 10 日
回答済み: Rahul Singhal 2020 年 10 月 12 日
Good morning,
i help a friend with his masterthesis and he is using the report generator with a word template to make his results visible (Matlab 2020a).
he create a word template (vorlage.dotx) which is stored in the same order than the programm. we used the following code
import mlreportgen.dom.*;
rtp = Document('Report','pdf','template.dotx');
open(rtp);
and got this error
Error using mlreportgen.dom.Document/open
Invalid template: template.dotx
Do you have any idea, where the problem is?
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 10 月 10 日
You said the template was vorlage.dotx but the code is trying to read from template.dotx
Jana Pecke
Jana Pecke 2020 年 10 月 10 日
oh sorry, we changed the name afterwards...
rtp = Document('Report','pdf','vorlage.dotx');
open(rtp);
Error using mlreportgen.dom.Document/open
Invalid template: vorlage.dotx

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

回答 (1 件)

Rahul Singhal
Rahul Singhal 2020 年 10 月 12 日
Hi Jana,
From your Document creation command, it looks like you are trying to generate a PDF report using a DOCX template, which is invalid. A DOCX template can only be used to create DOCX reports. This DOCX report can be later converted to PDF report using rptview. To directly generate a PDF report, I would suggest to create a PDF template, which is similar to an HTML template but with extension .pdftx. This link can be helpful in creating templates for different report types: https://www.mathworks.com/help/rptgen/report-templates.html
Thanks,
Rahul

カテゴリ

Help Center および File ExchangeReporting and Database Access についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by