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

Free Support Forum - aspose.com

How to read and write Content controls in a docx document?

Hi,
I have a Word document (docx) with some content controls inserted into the body.
See inside the attached zip the file ‘DocConContentControls.docx’: it contains for example 2 content control, a textbox and a pictutebox.
Using packages I’m able to insert a custom xml part (the file \customXml\item1.xml), and binding the content controls to this xml. With this operation I’m able to set the values of the content controls into the word document (even if only for textbox content controls). You can see the result in the file ‘DocConContentControls-2.docx’.
How can I do the same with Aspose?
I’ve readed that I can read and write content controls with Aspose, but I’ve not found the way or some example of code.
Can you provide me some example code?
I want to manage the image content control too, is it possible? And if yes, how?

Thank you.


This message was posted using Page2Forum (attachment) from CustomXmlParts Property - Aspose.Words for .NET

Hello

u1:p</u1:p>

Thanks for your request. Using the latest version of Aspose.Words you can get collection of StructuredDocumentTags using the following code:

// Open document

Document doc = new Document("C:\\Temp\\in.docx");

DocumentBuilder builder = new DocumentBuilder(doc);

// Get all StructuredDocumentTags

Node[] tags = doc.GetChildNodes(NodeType.StructuredDocumentTag, true).ToArray();

Then you can loop through this collection and get/insert image/text. But there is one problem, currently there is no way to get SDT properties (like Title, Tag etc) so there is no way to identify SDT object.

Your request has been linked to the appropriate issue. You will be notified as soon as the feature which allows you to get properties of STD is supported.

Best regards,

The issues you have found earlier (filed as WORDSNET-4010) have been fixed in this .NET update and this Java update.


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