Clear all documentbuilder paragraphformat direct formatting

I am trying to generate paragraphs using DocumentBuilder. I am setting the style to a style from the document I am updating. It gets the style, but some of the properties are being overridden by direct formatting on the DocumentBuilder.ParagraphFormat object.

Is there a way to delete all the direct formatting on the DocumentBuilder.ParagraphFormat object?

Thanks

Hi Brad,

Thanks for your inquiry. Please use ParagraphFormat.ClearFormatting method to reset to default paragraph formatting. Default paragraph formatting is Normal style, left aligned, no indentation, no spacing, no borders and no shading.

Moreover, Font.ClearFormatting to reset to default font formatting. This method removes all font formatting specified explicitly on the object from which Font was obtained so the font formatting will be inherited from the appropriate parent.

If you still face problem, please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.