We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Assigned style to a paragraph not applied to all runs

Hi Aspose,

We have upgraded Aspose.Words from to and seen this bug. Here is the sample block of codes to demonstrate the issue:

paragraph.ParagraphFormat.Style = newStyle;
foreach (Run run in paragraph.Runs)

In earlier version (13.11), after assigning [newStyle] to [paragraph], all the runs in that paragraph will also be assigned to that styles (if it does not have any direct style). And the runs already have the style/font needed.

But in this upgraded version (15.8), the newStyle is properly assigned to the paragraph (for example the paragraph having font name = “arial”) but not applied for the runs (for example, the run.Font still shows “times new roman” instead of “arial”).

This is a blocking issue for our product upgrade/development. Please help ASAP.

Hi Dawn,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words 13.11.0 generated output Word document which shows the correct output.
  • Aspose.Words 15.8.0 generated output Word document which shows the undesired output.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Best regards,

Hi Awais,

Here is the sample console app to demonstrate the problem.

In the sample, I hardcoded an XML string (“

This is <font size=“4” face=“Bernard MT Condensed”>simply a test

”), and print the text + font-name of the runs in the paragraph created by the above xml.

To see the differences between the 2 versions, you will need to replace the Aspose.Words reference used in the project (with the DLL in either lib13.11 or lib15.08 attached in the sample app). Below are the sample outputs:

  • Running with LIB13.11
importedParagraph - Font.Name = Arial
run - Text = [This is ] - Font.Name = Arial
run - Text = [simply] - Font.Name = Bernard MT Condensed
run - Text = [ a test] - Font.Name = Arial
      • Running with LIB15.08
      importedParagraph - Font.Name = Arial
      run - Text = [This is ] - Font.Name = Times New Roman
      run - Text = [simply] - Font.Name = Bernard MT Condensed
      run - Text = [ a test] - Font.Name = Times New Roman
            The problem is when running with LIB15.08, the run font does not change when we assign the new styles (e.g. Font name) to the paragraph. In LIB13.11, this works properly.

            Let me know if you need further information.


            Hi An,

            Thanks for the additional information. We have just released a new version of Aspose.Words i.e. 15.9.0; please upgrade to the latest version from following link:

            Secondly, please use the following overload of DocumentBuilder.InsertHtml method and specify ‘true’ value in second parameter:

            DocumentBuilder.InsertHtml Method (String, Boolean)

            Hope, this helps.

            Best regards,