Hi
Hi Allan,
Thank you for your reply,
Need solution soon…
Hi Allan,
Thanks for reply,
Hi Allan,
Hi:
Thanks again for your reply. However, I am getting a little frustrated because my manager is putting a lot of pressure on me and I have still not found (or received an answer) to my question. The documentation and all the examples (including the pointers you have provided) clearly show how to retrieve plain text or insert formatted text into a bookmark. However, there is nothing I can find to read formatted text from a bookmark when it contains
- New bookmark
- Hyperlink
- End of a paragraph
In going to your examples and documentation I finally stumbled upon this link
which briefly mentions the problem that I am having - but no solution (at least that I can see). Am I am missing something here ? and perhaps you can still help.
I have attached a file describing the problem I am having.
Any help you can provide is appreciated.
Hi Allan,
Thank you very much for your help. The sample program is working fine for me and I get the formatted text for all bookmarks. However there are two issues again.
Hi Allan,
Hi,
Hi Allan,
Hi:
Hi Allan,
Hi,
Hi Allan,
Hi Allan,
Document doc = new Document(Basepath+"BMDemo_Edit.doc");
BookmarkCollection bmCollection = doc.Range.Bookmarks;
DataTable dtUnitCurriculum = new DataTable();
foreach (Bookmark bm in bmCollection)
{
ArrayList nodes = ExtractContent1(bm.BookmarkStart, bm.BookmarkEnd);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < nodes.Count; i++)
{
Node node = (Node)nodes[i];
if (node.IsComposite)
{
sb.Append(node.ToString(SaveFormat.Html));
i = nodes.IndexOf(((CompositeNode)node).LastChild) + 1;
continue;
}
sb.Append(node.ToString(SaveFormat.Html));
}
string bookmarkName = bm.Name;
string bookmarkHtml = sb.ToString();
}
public static ArrayList ExtractContent1(Node startNode, Node endNode)<o:p></o:p>
{
ArrayList nodes = new ArrayList();
for (Node node = startNode; node != null && node != endNode; node = node.NextPreOrder(node.Document))
{
nodes.Add(node);
}
return nodes;
}
This code works fine. Thank you for reply.
Hi There is another issue I have encountered recently. The code works fine for single line text inside the bookmark. If I have a paragraph and when try to read the paragraph text inside the bookmark the loop goes indefinitely. I have attached the file which has the bookmark with paragraph text. Need solution to read both paragraph text and single line text. Your help will be appreciated.