フィルターのクリア

report generator Rapport format paysage

5 ビュー (過去 30 日間)
Daniel MONTERRAIN
Daniel MONTERRAIN 2023 年 6 月 30 日
コメント済み: Angelo Yeo 2023 年 7 月 11 日
je fais un rapport word que je veux formater en A3 paysage
currentLayout = d.CurrentPageLayout;
currentLayout.PageSize.Height = '11.69in';
currentLayout.PageSize.Width ='16.54in' ;
currentLayout.PageSize.Orientation = 'landscape'; % landscape portrait
%
Mon problème:
le changement de taille de la page est pris mais pas l'orientation
il faut lle modifier manuellement dans word après la génération du rapport
Par ailleuirs peut on définir la taillle de la page en cm et non en inch ?

回答 (2 件)

Angelo Yeo
Angelo Yeo 2023 年 7 月 3 日
Hi Daniel,
Please excuse me that I am not a French speaker. However, I hope this answer helps you.
  1. You can change the orientation in mlreportgen.dom.PageSize class.
  2. Yes you can use "cm" instead of "in".
Please take a look at the sample script below. This sample sript is mainly taken from this official documentation.
import mlreportgen.report.*;
import mlreportgen.dom.*;
rpt = Report("myreport1","docx");
open(rpt);
layoutObj = rpt.Layout;
layoutObj.PageSize = PageSize("29.6926cm","42.0116cm", "Landscape");
tp = TitlePage("Title","Title Page");
tplayoutObj = tp.Layout;
tplayoutObj.PageSize = PageSize("29.6926cm","42.0116cm", "Landscape");
append(rpt,tp);
toc = TableOfContents;
append(rpt,toc);
ch = Chapter("My Chapter");
para = Paragraph("This chapter uses the report page size");
close(rpt);
rptview(rpt);

Daniel MONTERRAIN
Daniel MONTERRAIN 2023 年 7 月 7 日
good morning
i tryed to use the command
layoutObj.PageSize = PageSize("29.6926cm","42.0116cm", "Landscape");
but it generates error "Creating a string using double quotes is not supported. Use the string function." (matlab R2016B)
then I tryed to use the command
currentLayout.PageSize = PageSize('29.6926cm','42.0116cm', 'Landscape');
and it seems to operate (but I don't know why, and why my previous version didn't)
Thank you for this solution !
  1 件のコメント
Angelo Yeo
Angelo Yeo 2023 年 7 月 11 日
It should be a version issue. I believe you need to use a recent version if you want to use double quote for the PageSize method. Even though the string type is introduced in R2016b it doesn't seem to be working for PageSize as expected.

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

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!