필터 지우기
필터 지우기

Document does not contain a document part template named: TitlePage

조회 수: 2 (최근 30일)
Yami
Yami 2022년 3월 11일
댓글: Xiaoning.Wang 2022년 4월 2일
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개)

카테고리

Help CenterFile Exchange에서 Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by