How to use CustomXmlProperty

Hi

Is it possible to write custom attributes to nodes, e.g. in form “w:attr”.

What I want is, save some additional information to paragraph, e.g. id or Name

Thanks
Stephan

Hi Stephan,

Thanks for your inquiry. Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

What I want, is this: I generate a document with aspose. When the user open the document in word and select any paragraph, I need some additional information to the selected paragraph as ID (GUID). This information are stored in external datastore. The problem is to store the ID (UUID) persistent over the time.

The problem:
-> CustomXml, are not supportet because an i4i patent
-> Word-Property ID, only html representation, will be not saved
-> paraID, textID, we have no control to write or to change, not accessible form Word API
-> Bookmarks, no good idea, user can change, or delete them

Solutions (?)
Maybe that can ben an alternativ: Use (Richtext)ContentControl. With Content Controls we can save additional.

When this is the only way? How can I add an richtextcontrol in an document an load an second document as content in the richtextcontrol?

What is the best way? Where can I find samples?

Best thanks
Stephan

Hi Stephan,

Thanks for your inquiry. Please use the following code example to insert RichText content control in the document and insert second document in it. Please get the code of InsertDocument method at following documentation link.

http://www.aspose.com/docs/display/wordsnet/How+to++Insert+a+Document+into+another+Document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

StructuredDocumentTag RichTextSDT = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Block);

doc.FirstSection.Body.AppendChild(RichTextSDT);

Paragraph para = new Paragraph(doc);

Run run = new Run(doc);

run.Text = "Hello World!";

para.AppendChild(run);

RichTextSDT.Tag = "sdt1";

RichTextSDT.RemoveAllChildren();

RichTextSDT.AppendChild(para);

Document newDoc = new Document(MyDir + "new document.doc");

InsertDocument(para, newDoc);

doc.Save(MyDir + "Out.docx");