HTML text formatting

Supported HTML tags and settings

Documotor supports importing HTML-formatted text into documents and presentations. As with most implementations, Documotor only supports a subset of HTML tags. Here is a complete list of supported tags, as well as the properties that can be used to override HTML styling.

Supported HTML tags

  • <b>
  • <br/>
  • <font face="" size="" color="">
    • face
      • Optional attribute, name of the font family.
    • size
      • Optional attribute, size of the font, integer from one to seven, three being the normal size.
    • color
      • Optional attribute, the color of the text. Can be a name ('Red'), a hex value ('#FF0000'), or an RGB-formatted string ('rgb(255,0,0)').
  • Headings
    • <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
  • <i>
  • <li>
  • <ol start="">
    • start
      • Optional attribute, the value of the first list item in the list
  • <p>
  • <sub>
  • <sup>
  • <u>

User style

It is possible to overwrite how tags change the style of a paragraph and introduce new inline tags. Inline tags are used within a paragraph, such as <b>. Here are a few examples followed by a list of all supported style properties.

Examples

The following user style makes the bold tag also add an underscore.

{ "b":  
  { "underscore": true }  
}

The type <Integer, String> is a dictionary with an integer key and string value. It is used when mapping the level of a list to a specific style or string/symbol. The level of a list starts at 0, with no indent. The following user style sets the style of a numbered list to use Arabic numbers at no indent, Roman numbers at one indent, and alphabetic letters at two indents.

{ "ol":
  { "bulletStyle":
    {
      "0": "1.",
      "1": "i.",
      "2": "a."
    }
  }
}

Style properties

  • Alignment
    • L (left), Ctr (center) or R (right).
  • BackgroundColor, string
    • The color behind the text, same format as TextColor.
  • BaseLine, number
    • Moves text down if negative, and up if positive. Default for Subscript and Superscript is -25000 and 30000 respectively.
  • Bold, boolean
    • Makes text bold if true
  • BulletChar, <integer, string>
    • A mapping of numbered list level, and what string to use as the bullet.
    • <integer, string> represents a dictionary with integer keys and string values.
  • BulletStyle, <integer, string>
    • A mapping of numbered list level and what style to use for bullets. The following types of bullets are supported:
      • l.
      • l)
      • i.
      • i)
      • I.
      • I)
      • a.
      • a)
      • A.
      • A)
  • DefaultFontSize, decimal number
    • The size of the text at a factor of one. Usually only set in the body, and then factor is used in the remaining tags, but it is not a requirement.
  • Font, text
    • Name of the font to use. Write it as displayed in Word/PowerPoint.
  • FontSizeFactor, decimal number
    • The size of the text in a tag is by default some % of the default font size. A factor of 1 means that size is unchanged.
  • Indent, number
    • Adds a margin to the left side of the first line of a paragraph.
  • IsNumbered, boolean
    • Marks paragraph as a numbered list item.
  • Italic, boolean
    • If true, makes text italic.
  • LineSpace, decimal number
    • Multiplier of line space in a paragraph. For example, 2 corresponds to 200% and 1.5 to 150%.
  • MarginLeft, number
    • Adds a margin to the left side of the entire paragraph.
  • NumberStart, number
    • The number of the first list item in a numbered list.
  • ShowBullet, boolean
    • Mark the paragraph as a bullet list item.
  • SpaceAfter, decimal number
    • Points of empty space to add after a paragraph.
  • SpaceBefore, decimal number
    • Points of empty space to add before a paragraph.
  • TextColor, text
    • The color of the text. Can be a name ('Red'), a hex value ('#FF0000'), or an RGB-formatted string ('rgb(255,0,0)').
  • Underscore, boolean
    • Adds a single line of underscore to the text if true.