我使用Docx dll获取段落信息但无法获取段落格式(font size-fontName-FontColor) 这是我的代码:
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
}
}
}
答案 0 :(得分:3)
你可以这样做:
pg.magictext[i].formatting.fontfamily.name.tostring()