We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Update CustomXmlPart does not Update the Linked Content Control (SDT)

Hi


I have the following Document created in MS Word:
- A content control that is linked to a CustomXmlPart
- The CustomXmlPart that is linked from the content control

Now I update CustomXmlPart using Aspose (11.5).

But the Resulting PDF does not have the updated text in it.

We had a similar issue with document variables, properties etc. where we just called Document.UpdateFields() after updating the values and it worked.

But this does not help with the Content Controls.

Is this a bug?
Or is there a way to force an update of content controls?

Thanks
Philipp

Hi Philipp,


Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

Please find the docx attached

Hi
Philipp,


Thanks for your inquiry and sorry for the delayed response. Could you please also share your complete code here for testing? I will try to reproduce the same issue on my side and provide you more information.

Best Regards,

Hi
Philipp,


Thanks for your patience. You’re right; Aspose.Words currently doesn’t support databining and content update from customXml to Sdt in SDT controls. Your request has been linked to the appropriate new feature (WORDSNET-4738) in our issue tracking system and you will be notified as soon as it is supported. Sorry for the inconvenience.

Best Regards,

Hi Awais


Thanks for your reply, so I don’t have to provide the code to reproduce anymore?
Sorry for my late reply. I was on vacation for a week…

Regards
Philipp

Hi Philipp,


Thanks for your inquiry. Just in case, please share your code here for testing. I will make sure the problem you’re facing on your side is the same issue as the one linked to this thread.

Best Regards,

Hi Awais


Here is the code (of course it is simplified compared to our real implementation) but it’s what happens with the aspose document object in our use case

            var stream = this.resourceLoader.LoadResourceAsStream(typeof(When_updating_custom_xml_parts), “ContentControlTemplate.docx”);
        <span style="color:blue;">var</span> document = <span style="color:blue;">new</span> <span style="color:darkblue;">Document</span>(stream);

        <span style="color:blue;">var</span> customXmlPart = document.<span style="color:purple;">CustomXmlParts</span>.<span style="color:darkcyan;">Cast</span><<span style="color:darkblue;">CustomXmlPart</span>>().<span style="color:darkcyan;">Where</span>(cxp => cxp.<span style="color:purple;">Schemas</span>[0] == <span style="color:#a31515;">"FirstNamespace"</span>).<span style="color:darkcyan;">Single</span>();
        <span style="color:blue;">var</span> xml = <span style="color:darkblue;">XDocument</span>.<span style="color:darkcyan;">Load</span>(<span style="color:blue;">new</span> <span style="color:darkblue;">MemoryStream</span>(customXmlPart.<span style="color:purple;">Data</span>));

        <span style="color:blue;">var</span> nsManager = <span style="color:darkcyan;">GetXmlNamespaceManagerFor</span>(<span style="color:#a31515;">"FirstNamespace"</span>);

        xml.<span style="color:purple;">Root</span>.<span style="color:darkcyan;">XPathSelectElement</span>(<span style="font-weight:bold;color:purple;">XPathNamespacePrefix</span> + <span style="color:#a31515;">":Expression"</span>, nsManager).<span style="color:purple;">Value</span> = <span style="color:#a31515;">"first value"</span>;

        document.<span style="color:darkcyan;">Save</span>(<span style="color:#a31515;">@"C:\temp\contentControl.pdf"</span>, <span style="color:blue;">new</span> <span style="color:darkblue;">PdfSaveOptions</span>());

Also see the complete sample code in the attached zip.

Best Regards
Philipp

Hi
Philipp,


Thanks for the additional information. We will keep you informed of any developments and let you know via this forum thread once your problem is resolved. We apologize for your inconvenience.

Best Regards,

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(11)