Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Code

Insert text formatted as code in a paragraph

Description

This component inserts text formatted as code in a paragraph. The purpose of the component is to distinguish code, such as variable and property names, from other text in a paragraph. Its default style, rgCode, uses a monospace font instead of the default proportional font used by a Paragraph or Text component. The Code component also preserves white space (line feeds and spaces) in HTML and Word output. You can use this component to insert code in paragraphs in HTML, Word, and PDF reports. You can also use it to insert code in table entries and at the report body level in HTML reports, for example, web (HTML) reports.

Note

This component applies only to template-based reports, such as Direct PDF (from Template). In XSL style sheet-based reports, for example web (HTML), it serves as a Text component.

Properties

  • Code to include in report: Specifies the code to include in the paragraph.

  • Style Name: Specifies the name of a style used to format the code. By default, the style name is rgCode, which is defined in the Report Explorer default document conversion templates. To override the default style:

    1. Set Style Name to Specify.

    2. In the Style Name text box, type a style name.

      To use the custom style you specify, it must be defined as a span style in the HTML or PDF template used with this report. For a Word template, it must be defined as a character or linked paragraph/character style. For more information about template styles, see Report Templates.

Style

  • Bold: Makes the text bold.

  • Italic: Makes the text italic.

  • Underline: Underlines the text.

  • Color: Specifies the color of the text.

    • Select a color from the list of colors.

    • Enter a hexadecimal RGB value as #RRGGBB. For example, #0000ff is a shade of blue.

    • Enter %<expr>, where expr is a MATLAB® expression that evaluates to a color name or a hexadecimal RGB value.

Note

These format options override any corresponding formats defined in the custom style you specify. For example, selecting Bold makes the text bold, even if the specified style uses regular weight text.

Insert Anything into Report?

Yes. Inline text formatted as code.

For example, if you include a Code component with "Code     component  text" in a paragraph, the output appears exactly has you have typed it, preserving all of the spaces.

Class

rptgen.cfr_code

Was this topic helpful?