Rendering special characters in DocX

Scenario

Special characters such as the right single quotation mark (’) and the double quotation marks (“…”) are rendered differently (’) and (“…”) in DocX output.

Example 1,
image

Example 2,

Cause

Special characters such as the right single quotation mark (’) and the double quotation marks (“…”) are reserved characters in HTML and if your data source includes special characters and are enclosed in html tags, the report renderer will render these characters incorrectly in DocX output.

Refer to HTML Special Characters to view the list of HTML Special Characters

Resolution

  • Replace the special characters with their Entity Name equivalents in the data via the Replace function in SQL query or address these special characters at the application level so that they are already formatted to their HTML equivalents during the insertion to their database tables.

    For example 1, companies’ should be replaced with
    image

    For example 2, the left and right double quotation marks should be replaced with
    image and image respectively.

  • Alternatively, insert the following meta tag declaration in the affected content. Refer How to Use Special Characters in HTML for more information.