How do I adjust the font size of text and table components in a PDF report generated using Simulink Report Generator in MATLAB R2024a?

4 views (last 30 days)

I am generating a PDF report using the Simulink Report Generator app for my Simulink model in MATLAB R2024a.

A simple sample report containing body text and tables is shown below:

How do I adjust the font size for the "Table" and "Text" components in my report above?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 Oct 2024
You can modify the font size of these components in a PDF report following the below instructions:
1. Make a copy of the "Default PDF Template" using the instructions at the following link:
2. Select the new template copy; in the right-hand dialog pane, click "Open style sheet" to open the template's "root.css" file within MATLAB.
3. Within "root.css", make the following changes:
3a. Text elements are controlled with the "rgBody" style. Comment out the CSS style "p.rgBody, p.rgParagraph" on line 453, and add a new definition of "p.rgBody" with the desired font size, as follows:
/*p.rgBody, p.rgParagraph { font-family: rg-body; font-size: 10pt; margin-top: 10pt; line-height: 13pt; }*/ p.rgBody { font-family: rg-body; font-size: 20pt; // Control Text font size here }
3b. Table elements are controlled by the "rgUnruledTable" style, shown in the "Table style name" setting in the right-hand dialog pane of your "Table" element in the Report Generator. Thus, the font size of the header ("thead"), body ("tbody") and footer ("tfoot") of the table may be controlled within "root.css" by the "font-size" parameter in the "rgUnruledTable" style elements, as follows:
table.rgUnruledTable > thead> tr> td { font-family: rg-sans; font-size: 5pt; // Header font size padding: 2pt 2pt 2pt 2pt; } table.rgUnruledTable > tbody > tr> td { font-family: rg-sans; font-size: 5pt; // Body font size padding: 2pt 2pt 2pt 2pt; } table.rgUnruledTable > tfoot > tr> td { font-family: rg-sans; font-size: 5pt; // Footer font size padding: 2pt 2pt 2pt 2pt; }
3c. To adjust properties for other components beyond text/table, make changes to the associated "root.css" styles given in the following link: 
4. In the top-level report options in the Report Generator, set the "File Format" of "Report Output Type and Templates" setting to "Direct PDF (from Template)". Then, within the same setting, set the PDF template to your new template copy from Step 1. Now, generated PDF reports will be using the new template with the above font size modifications.
An example of changing the font size of text and table components for the sample report in the question is shown below:

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!