How get paragraph FontName with Docx dll?

血红的双手。 提交于 2019-12-11 02:56:16

问题


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()


来源:https://stackoverflow.com/questions/20104889/how-get-paragraph-fontname-with-docx-dll

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