Content Control with Section Break gets lost

I am using latest .NET aspose dll. Still facing same issue.

@snehalghute Could you please attach the problematic document and the output document produced on your side along with code that will allow us to reproduce the problem here for testing? We will check the issue and provide you more information.

Check sectionBreakIssueissue.docx file has 2 rich text content control. For content_effective_date control added contents with Section break. You can see this this content control is not returned by GetChild method.SectionBreakIssue.zip (308.8 KB)

@snehalghute In your document there are two structured document tags that spans several sections. In this case Aspose.Words represents such SDTs with StructuredDocumentTagRangeStart and StructuredDocumentTagRangeEnd nodes. That is why you do not get these SDTs when use doc.GetChildNodes(NodeType.StructuredDocumentTag, true) .

// Regular SDTs
NodeCollection sdts = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);
Console.WriteLine(sdts.Count);
foreach(StructuredDocumentTag sdt in sdts)
    Console.WriteLine(sdt.Title);

// Starts of SDTs spanned multiple sections
NodeCollection sdtStart = doc.GetChildNodes(NodeType.StructuredDocumentTagRangeStart, true);
Console.WriteLine(sdts.Count);
foreach (StructuredDocumentTagRangeStart start in sdtStart)
    Console.WriteLine(start.Title);

I added multiple sections in one content control. Can you modify document and send me to handle this multiple section break with different layout for each page?

@snehalghute No document modifications are required. As I mentioned structured document tags that spans several sections are represented with StructuredDocumentTagRangeStart and StructuredDocumentTagRangeEnd nodes. So you should handle these SDTs differently than the regular SDTs.

Thank you Alexey. Solution worked fine.

1 Like