Hi,
Please help on how to apply style on already created bookmark?
the word template already has bookmarks…through aspose find the bookmark and apply text and style to it.
Please advise.
Hi,
Hi there,
Document doc = new Document(MyDir + “in.docx”);<o:p></o:p>
Bookmark bm = doc.Range.Bookmarks["bm"];
Node node = bm.BookmarkStart;
node = node.ParentNode;
while (bm.BookmarkEnd != node)
{
if (node.NodeType == NodeType.Paragraph)
{
Paragraph para = (Paragraph)node;
para.ParagraphFormat.ClearFormatting();
foreach (Run run in para.Runs)
{
run.Font.ClearFormatting();
}
//set the paragraph style
para.ParagraphFormat.StyleName = "Heading 1";
}
node = node.NextPreOrder(doc);
}
doc.Save(MyDir + "17.4.docx");