Create a table that contains text and figures using the reporting toolbox
Hi! I am using your reporting function but I have had struggles building a scheme 2 by 2 where positions 1 and 4 are figures, and positions 2 and 3 text.
I have this code:
tp = TitlePage();
tit = Paragraph("Presentación del Primer Trimestre de 2024:");
tit.Style = {HAlign("left"),FontFamily("sans-serif"),…
FontSize("45pt"),Color("white"),…
BackgroundColor("#0072BD"),…
OuterMargin("0in","0in",".5in","1in"),…
HAlign("center")};
tp.Title = tit;
add(rpt, tp);
%% my code to create figures – plots
var_name = [‘fig’, num2str(j),’Img’];
eval([var_name, ‘ = Image(getSnapshotImage(Figure(fig), rpt));’]);
% Close the figure to avoid accumulation
close(fig);
end
% % % % % % % % ================================ PAGE 1 ===============================
br = PageBreak();
intro1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
append(rpt, intro1)
lo_table1 = Table({
fig1Img, fig2Img; …
fig3Img, []});
lo_table1.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table1);
% % % % % % % % ================================ PAGE 2 ===============================
% Define the HTML content for the text cells
PAR1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
PAR2 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
lo_table2 = Table({ fig4Img, PAR1);…
PAR2, fig5Img});
lo_table2.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table2);
br2 = PageBreak();
append(rpt,br2)
close(rpt);
rptview(rpt);
My problem is that the figures appears in my PDF report. But the text does not.
How can I solve it?
Thanks in advance.Hi! I am using your reporting function but I have had struggles building a scheme 2 by 2 where positions 1 and 4 are figures, and positions 2 and 3 text.
I have this code:
tp = TitlePage();
tit = Paragraph("Presentación del Primer Trimestre de 2024:");
tit.Style = {HAlign("left"),FontFamily("sans-serif"),…
FontSize("45pt"),Color("white"),…
BackgroundColor("#0072BD"),…
OuterMargin("0in","0in",".5in","1in"),…
HAlign("center")};
tp.Title = tit;
add(rpt, tp);
%% my code to create figures – plots
var_name = [‘fig’, num2str(j),’Img’];
eval([var_name, ‘ = Image(getSnapshotImage(Figure(fig), rpt));’]);
% Close the figure to avoid accumulation
close(fig);
end
% % % % % % % % ================================ PAGE 1 ===============================
br = PageBreak();
intro1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
append(rpt, intro1)
lo_table1 = Table({
fig1Img, fig2Img; …
fig3Img, []});
lo_table1.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table1);
% % % % % % % % ================================ PAGE 2 ===============================
% Define the HTML content for the text cells
PAR1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
PAR2 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
lo_table2 = Table({ fig4Img, PAR1);…
PAR2, fig5Img});
lo_table2.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table2);
br2 = PageBreak();
append(rpt,br2)
close(rpt);
rptview(rpt);
My problem is that the figures appears in my PDF report. But the text does not.
How can I solve it?
Thanks in advance. Hi! I am using your reporting function but I have had struggles building a scheme 2 by 2 where positions 1 and 4 are figures, and positions 2 and 3 text.
I have this code:
tp = TitlePage();
tit = Paragraph("Presentación del Primer Trimestre de 2024:");
tit.Style = {HAlign("left"),FontFamily("sans-serif"),…
FontSize("45pt"),Color("white"),…
BackgroundColor("#0072BD"),…
OuterMargin("0in","0in",".5in","1in"),…
HAlign("center")};
tp.Title = tit;
add(rpt, tp);
%% my code to create figures – plots
var_name = [‘fig’, num2str(j),’Img’];
eval([var_name, ‘ = Image(getSnapshotImage(Figure(fig), rpt));’]);
% Close the figure to avoid accumulation
close(fig);
end
% % % % % % % % ================================ PAGE 1 ===============================
br = PageBreak();
intro1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
append(rpt, intro1)
lo_table1 = Table({
fig1Img, fig2Img; …
fig3Img, []});
lo_table1.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table1.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table1);
% % % % % % % % ================================ PAGE 2 ===============================
% Define the HTML content for the text cells
PAR1 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
PAR2 = HTML([‘<p style="white-space:pre; font-size: 25px; font-family: sans-serif;">’, …
‘SOMETHING.</p>’,…
]);
lo_table2 = Table({ fig4Img, PAR1);…
PAR2, fig5Img});
lo_table2.entry(1,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(1,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,1).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.entry(2,2).Style = {Width(‘8in’), Height(‘3.8in’)};
lo_table2.Style = {Width(‘100%’), ResizeToFitContents(true)};
add(rpt, lo_table2);
br2 = PageBreak();
append(rpt,br2)
close(rpt);
rptview(rpt);
My problem is that the figures appears in my PDF report. But the text does not.
How can I solve it?
Thanks in advance. #reports MATLAB Answers — New Questions