Adding w:divId to paragraph properties

Hi,

I’ve attached two files - heading_NoDivId and heading_WithDivId, each containing the same two paragraphs with shading. In the _NoDivId the shading on both paragraphs extends from one to the other, and in the _withDivId shading on the paragraphs is separated. The only difference is that the latter one defines w:divId in paragraph properties of the second paragraph, and that changes how the shading is rendered. Is it possible to replicate this behavior with Aspose.Words?

Thanks,
Tomek

headng_NoDivId.docx (10.0 KB)
heading_withDivId.docx (11.7 KB)

@acturisaspose divId is assigned to paragraph only when document is imported from HTML. You can achieve the same using Aspose.Words by using BlockImportMode.Preserve:

HtmlLoadOptions opt = new HtmlLoadOptions();
opt.BlockImportMode = BlockImportMode.Preserve;

Document doc = new Document(@"C:\Temp\in.html", opt);
doc.Save(@"C:\Temp\out.docx");

In such case Aspose.Words mimics MS Word behavior when process DIVs in HTML.