Hi,
Thanks for your posting.
Please try the following solution.
- Code: Select all
Document document = new Document();
document.LoadFromFile("test.docx");
foreach (Section section in document.Sections)
{
foreach (Paragraph p in section.Paragraphs)
{
if (p.Format.OutlineLevel != OutlineLevel.Body)
{
p.ApplyStyle("Heading 1");
foreach (DocumentObject obj in p.ChildObjects)
{
if (obj.DocumentObjectType == DocumentObjectType.TextRange)
{
(obj as TextRange).CharacterFormat.FontName = "Calibri";
}
}
}
}
}
document.SaveToFile(result,FileFormat.Docx2013);
If the above solution doesn't help, please share your source file and expected result so that we do a demo for you soon.
You can also send them to
support@e-iceblue.com if it is inconvenience to share them here.
Best Regards,
Amy
E-iceblue support team