Document does not contain a document part template named: TitlePage

1 次查看(过去 30 天)
I need to create a PDF report with a logo on the first page & ideally on the header of all pages. It should be actually a corporate Title Page and Header of the institution I am studying at. I´m feeling really frustrated since it is not as I thought initially, that it was just as simple as importing the template of the institution, and just writting over it and adding the matlab plots. Now I´m dealing with html and css files and it´s not working as I expected. I hope somebody can help me, please.
I have created a rpt = Report(), and I could change the font-family for the chapters following the instructions that Mathworks stuff posted on a previous question. (Through the css file of the template).
However, I wanted to do the same for the TitlePage and it was not possible since, as you can see on the screen capture, the document does not contain a document part template name: TitlePage. I guess this is because TitlePage is only available for report but not for Dom? I´m doing it this way because creating a template for only this document part should be easier, instead of copying the default templates of every document parts and pasting them on only one template and use it in: rpt = Report('Measurement_Analysis_Report','PDF', 'mytemplate.pdftx').
I should use the corporate template but I don´t know how, is it possible on Matlab?
% Import the Report API package..
import mlreportgen.report.*
import mlreportgen.dom.*
%zipTemplate('Template_Title_Page.pdftx', 'Template_Title_Page')
%zipTemplate('Template_Chapter.pdftx', 'Template_Chapter')
% template = mlreportgen.report.TitlePage.createTemplate('Default_Template','pdf');
% unzipTemplate('Default_Template.pdftx', 'Template_Tittle_Page');
%Create Report Object and set to english language
rpt = Report('Measurement_Analysis_Report','PDF');
rpt.Locale = 'en';
%% Header
% Add a title page and table of contents to the report.
tp = TitlePage;
%tp = mlreportgen.report.TitlePage();
tp.TemplateSrc ='Template_Title_Page.pdftx';
% tp.Image=which('logo.png');
tp.Title = 'Measurement Data Analysis';
tp.Subtitle = 'Standard Case';
tp.Author = 'J. B';
tp.PubDate = date();
add(rpt, tp);
add(rpt,TableOfContents);
% fig = [fig1, ... fign]
% First chapter: States
ch1 = Chapter('States');
ch1.TemplateSrc='Template_Chapter.pdftx';
for i = 36:40
Fig = mlreportgen.report.Figure(fig(i));
Fig.Scaling='custom';
Fig.Width = "13cm";
Fig.Height = "8.03cm";
add(ch1,Fig);
end
Fig = mlreportgen.report.Figure(fig(41));
Fig.Scaling='custom';
Fig.Width = "13cm";
Fig.Height = "13cm";
add(ch1,Fig);
add(rpt,ch1);
Thanks in advance
  1 个评论
Xiaoning.Wang
Xiaoning.Wang 2022-4-2
我也遇到类似的问题,
Document does not contain a document part template named: Section1
出错 mlreportgen.report.internal.DocumentPart/open
出错 mlreportgen.report.Chapter/openImpl
出错 mlreportgen.report.ReporterBase/getDocumentPart
出错 mlreportgen.report.ReporterBase/getImpl
出错 mlreportgen.report.Section/getImpl
出错 mlreportgen.report.internal.LockedForm.add
出错 mlreportgen.report.ReportBase/append
出错 mlreportgen.report.ReportBase/add
我感觉是自己创建的dotx模板存在问题,但是不知道如何设计这个doc模板呢?

请先登录,再进行评论。

回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by