在我的应用程序中,我需要加载.doc应用程序来更改字体大小。它适用于单个段落,但当我需要时
更改整个段落的字体大小并不适用于所有段落。
我试过下面的方法
Section s = document.Sections[0];
int i = s.Paragraphs.Count;
ParagraphStyle style = new ParagraphStyle(document);
for (int j = 0; j < i; j++)
{
Spire.Doc.Documents.Paragraph p = s.Paragraphs[j];
style.CharacterFormat.FontName = "Times New Roman";
style.CharacterFormat.FontSize = 20;
document.Styles.Add(style);
p.ApplyStyle(style.Name);
}上面的方法不起作用,我怎么才能改变所有段落的字体大小,整个文档中我在循环中犯了错误,有谁能告诉我。
谢谢
发布于 2019-04-29 20:49:53
它没有运行的原因是你没有安装style.Name。您需要设置style.Name才能被p.ApplyStyle(style.Name);识别
https://stackoverflow.com/questions/42665848
复制相似问题