How get paragraph FontName with Docx dll?

匿名 (未验证) 提交于 2019-12-03 00:59:01

问题:

I am using Docx dll to get paragraph information but not able to get paragraph format(font size-fontName-FontColor) Here is my code for that:

        using (DocX document = DocX.Load("Test.docx"))         {              if (document.Paragraphs.Count() > 0)             {                  for (int i = 0; i < document.Paragraphs.Count; i++)                 {                     Novacode.Paragraph pg = document.Paragraphs[i];                     Console.WriteLine("Text:" + pg.Text +" Alignment:" + pg.Alignment + " Direction:" + pg.Direction);                     //how get FontName                 }             }         } 

回答1:

You can do this:

pg.magictext[i].formatting.fontfamily.name.tostring() 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!