We are using XML Bindings to synchronize some fields to document headers.
While this is working perfectly with older Aspose.Words versions, it leads to serious problems with 25.7.
We are currently running 2017.3 and tried to update to 25.7 due to issues with formula rendering.
But with 25.7 the sychronisation lead to enourmous amounts of XML garbage in the document and corresponding memory consumption.
See attached example to reproduce this issue.
Aspose25-7_Bug.7z (465.4 KB)
@stgross
It sounds like you’re experiencing significant memory issues and XML formatting problems when using Structured Document Tags (SDTs) with Aspose.Words version 25.7. This can be frustrating, especially since it worked well in earlier versions.
Here’s a step-by-step approach to diagnose and resolve the issue:
-
Check for Updates: Ensure you are using the latest version of Aspose.Words. Issues are often resolved in subsequent releases, so check for any newer versions available.
-
Review XML Bindings: Since you mentioned using XML bindings to synchronize fields, double-check the bindings for any discrepancies or errors that might lead to excessive XML generation.
-
Memory Management: Monitor the memory usage during document processing. If the document is large or complex, optimize your handling of the document by processing it in smaller chunks or using more efficient data structures.
-
Test with Simplified Documents: Create a simplified version of your document to see if the issue persists. This can help isolate whether the problem is with specific content or the overall structure.
-
Contact Support: If the problem continues, reach out to Aspose support with your specific use case and the example document you provided. They may have insights or fixes for the issues you’re encountering.
By following these steps, you should be able to identify the cause of the issues and implement a solution. If you have any further questions or need additional assistance, please let me know!
This issue should be investigated by technical support please.
@stgross
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28542
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The problem occurs because value of date SDT is set improperly. You can modify your code like this to resolve the problem:
private static void fillFields(Document document, Map<String, String> reportValues) throws Exception {
NodeCollection<StructuredDocumentTag> nodeCollection = document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true);
for (StructuredDocumentTag structuredDocumentTag : nodeCollection) {
String tagName = structuredDocumentTag.getTag();
if (reportValues.containsKey(tagName)) {
String value = reportValues.get(tagName);
if(structuredDocumentTag.getSdtType() == SdtType.DATE)
{
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
structuredDocumentTag.setFullDate(format.parse(value));
continue;
}
if(structuredDocumentTag.getFirstChild() != null){
int nodeType = structuredDocumentTag.getFirstChild().getNodeType();
switch (nodeType) {
case NodeType.RUN:
structuredDocumentTag.removeAllChildren();
Run run = new Run(document);
run.setText(value);
structuredDocumentTag.appendChild(run);
break;
default:
break;
}
}
}
}
}
The issues you have found earlier (filed as WORDSNET-28542) have been fixed in this Aspose.Words for .NET 25.9 update also available on NuGet.