Getting SDT child element that contains section break not working

I have an issue with retrieving child nodes when working with SDTs.


In one document I have SDT container that has within itself one continues break. When getting child nodes of that document, Aspose is not retrieving that SDT. In case when I remove break, SDT will be retrieved. When I tried same logic with OpenXml I got SDT/ContentControl without a problem.

Problematic document with SDT container in attachment : ProblematicDocument.docx

Aspose code snippet :

public static void OpenDocument(string documentName)
{
Aspose.Words.Document document = new Aspose.Words.Document(documentName);

List nodes =
document.Document.GetChildNodes(NodeType.StructuredDocumentTag, true).Cast().
ToList();

// List nodesAll = document.Document.GetChildNodes(NodeType.Any, true).Cast().ToList();
}

In case that I uncomment last line, Aspose will also ignore and will retrieve all nodes except SDT.

Classic code snippet :

public static void OpenDocumentXml(string documentName)
{
using (WordprocessingDocument document =
WordprocessingDocument.Open(documentName, true))
{
//Get all block content controls
List<WordProcessing.SdtBlock> sdtBlocks =
document.MainDocumentPart.Document.Descendants<WordProcessing.SdtBlock>()
.ToList();
}
}

Thanks,


Hi Rastko,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13519. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir,


do you have some forecasts when we can expect patch for this to plan our release further.

Many thanks,
Hi Rastko,

Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is under analysis phase. Once our product team completes the analysis of your issue, we will then be able to provide you an estimate.

Thanks for your patience and understanding.

Hi Rastko,

Thanks for your patience. Our product team has completed the work on your issue and has come to a conclusion that they won't be able to implement the fix to your issue. Your issue (WORDSNET-13519) is now closed with 'Won't Fix' resolution. This is because the requested feature is not compatible with Aspose.Words document model. We apologize for your inconvenience.

Dear Support,


I would like to escalate this issue to your management team. We need to have this feature reported by our team fixed. This will have a major impact for us using your plugin within our application. Please put me in touch with your management teamt to discuss how we can resolve this reported issue.
Hi Rastko,

We are really very sorry for your inconvenience. Unfortunately, the requested feature is not compatible with our document model. We are in communication with our product team about this feature. Once we have any information from our product team, we will be more than happy to share that with you.

This is not an acceptable response. I have requested that this case gets escalated to your management team. Could you please direct me to the management team so I can discuss our needs and why we need this issue be fixed soon?

Hi Rastko,

Thanks for your inquiry. Your issue has been escalated to our management team. You will get reply on this issue soon.

We apologize for your inconvenience.

Please have your management team contact me Roya Azimi razimi@calliduscloud.com. My phone number is 925-251-2237. I am the Director of Product Management for our CPQ solution.

Hi there,

Your document contains section break inside structured document tag. As per current Aspose.Words document model, only sections can be inserted into Document node. If section break is cut from structured document tag and paste after it then the shared code will start work properly. Please use this workaround for your scenario.

Please check the detail of StructuredDocumentTag. StructuredDocumentTag can occur in a document in the following places:

  • Block-level - Among paragraphs and tables, as a child of a Body, HeaderFooter, Comment, Footnote or a Shape node.
  • Row-level - Among rows in a table, as a child of a Table node.
  • Cell-level - Among cells in a table row, as a child of a Row node.
  • Inline-level - Among inline content inside, as a child of a Paragraph.
  • Nested inside another StructuredDocumentTag.

Please check the attached word document (ProblematicDocument_Valid.docx) and DOM image. The StructuredDocumentTag is under Body node of Section. Your document should not contain section break inside StructuredDocumentTag. Please insert section break in your document as shown in ProblematicDocument_Valid.docx. Hope this clears the detail of issue.

Dear Support,


Thank you so much for the update but this still doesn’t resolve our issue with the break point and we need to have a workaround solution for this issue. As I mentioned, this will impact all of our customers and we are not able to use your solution that handles all of our use cases. Can we have a call on this issue with your management team so I can understand how Aspose will helps us to find a resolution for this issue and how we can get around?

Please contact me directly Roya Azimi razimi@calliduscloud.com 925-202-7434. I am located in Pacific time zone.

Hi Rastko,

Thanks for your inquiry.

Aspose.Words document object model is not compatible with the feature discussed in this forum thread. We are in communication with our product team about this feature. We will get back to you soon.

Hi Rastko,

Thanks for your patience.

We have received response from our product team about this issue. There is no solution for this issue at this stage. We cannot do it technically.

@risajev

It is to inform you that we have added read only properties for content control that contains the section break. You can find the detail of these properties from here:

Please use following code example to get the title of content controls. Hope this helps you.

var doc = new Document(MyDir + "my_sample.docx");
foreach (StructuredDocumentTagRangeStart tag in doc.GetChildNodes(NodeType.StructuredDocumentTagRangeStart, true))
    Console.WriteLine(tag.Title);

foreach (StructuredDocumentTag tag in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
    Console.WriteLine(tag.Title);

The issues you have found earlier (filed as WORDSNET-13519) have been fixed in this Aspose.Words for .NET 20.7 update and this Aspose.Words for Java 20.7 update.