Hi
Just went through the Document Manipulation Features posted in your site...
Can you please provide code examples for the below mentioned features...
Thanks & Regards
mano
Hi
Just went through the Document Manipulation Features posted in your site...
Can you please provide code examples for the below mentioned features...
Thanks & Regards
mano
The document is a tree of nodes, for example paragraphs, tables, rows, cells, runs of text. Most of the operations you can do are tree-oriented. You can easily copy any node, for example if you want a copy of a paragraph (any node in fact) inserted below a particular paragraph:
//Lets take 1st paragraph for an example
Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);
//Make a copy
Paragraph newPara = para.Clone(true);
//Insert after the reference paragraph.
para.ParentNode.InsertAfter(newPara, para);
Having said that, there are not many operations to deal with an arbitrary fragment of text directly. For example there is no direct way for selecting and copying text from position 10 to 20 in a document. I mean it is possible if you code it, but there is no single method that does it in the public API yet.
If you want to deal with arbitrary fragments of text you essentially need to iterate over the nodes and work with the nodes like in an XML document. It is quite hard to marry both tree and flat-text models into one API, but we will provide more public methods to deal with arbitrary flat fragments of text in the future.