Hi,
I have a bookmark in a doc, I can do that:
doc1.Range.Bookmarks("agency").Text = "Agnecy",
how can I change the font style of this bookmark item?
eg: doc1.Range.Bookmarks("agency").Font.StrikeThrough = true
Please help
Paul
Hi,
I have a bookmark in a doc, I can do that:
doc1.Range.Bookmarks("agency").Text = "Agnecy",
how can I change the font style of this bookmark item?
eg: doc1.Range.Bookmarks("agency").Font.StrikeThrough = true
Please help
Paul
Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your request. I think that you can try using the following code to achieve this.
Document doc = new Document(@"Test160\in.doc");
//Insert text into the bookmark
doc.Range.Bookmarks["myBookmark"].Text = "text in bookmark";
//Get next node after bookmark start
Node currentNode = doc.Range.Bookmarks["myBookmark"].BookmarkStart.NextSibling;
//Change font of each run inside bookmark
while (currentNode.NodeType != NodeType.BookmarkEnd)
{
if (currentNode.NodeType == NodeType.Run)
(currentNode as Run).Font.StrikeThrough = true;
//Move to next node
currentNode = currentNode.NextSibling;
}
//Save output document
doc.Save(@"Test160\out.doc");
Hope this helps.
Best regards.
It’s work. thanks a lot