How do I import a background color and gradient?

Is it possible to use ImportNode with KeepSourceFormatting to import nodes from a document that has a background gradient? Currently, the background color and gradient appears to be ignored. After loading up the document, I iterated over the child paragraphs of the document and examined their ParagraphFormat.Shading.BackgroundPatternColor and they were all set to white. Thoughts? My test document is attached.

Thanks.

Hi
Thanks for your inquiry. Background is property of the whole document. Unfortunately you can’t set background of document using Aspose.Words. As workaround you can use template with background.
Best regards.

Ok, so if I am trying to import the background from another document, I can just load up the original document and call RemoveAllChildren on it to use it as a template? Also, is there anyway to get the background persisted when saving to HTML?

Hi

  1. Yes you can remove all children from your document and use it as template.
  2. No there is no way to get the background persisted when saving to HTML.

Please let me know if you would like to know anything else. I will be happy to help you.
Best regards.