如何在c#windows应用程序中使用spire.doc dll更改.doc文档所有段落的字体大小
在我的应用程序中,我需要加载.doc应用程序以更改字体大小。它只适用于单个段落,但当我需要时 要更改整个段落的字体大小,并非所有段落都适用 我试过下面的方法如何在c#windows应用程序中使用spire.doc dll更改.doc文档所有段落的字体大小,c#,winforms,fonts,C#,Winforms,Fonts,在我的应用程序中,我需要加载.doc应用程序以更改字体大小。它只适用于单个段落,但当我需要时 要更改整个段落的字体大小,并非所有段落都适用 我试过下面的方法 Section s = document.Sections[0]; int i = s.Paragraphs.Count; ParagraphStyle style = new ParagraphStyle(document); for (int j = 0; j &
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);
}
Section s=document.Sections[0];
int i=s.Count;
段落样式=新段落样式(文档);
对于(int j=0;j
以上内容不起作用,我如何更改整个文档中所有段落的字体大小,如果我在循环中出错,请任何人告诉我
谢谢它没有运行的原因是您没有设置
style.Name
。
您需要设置
style.Name
才能被p.ApplyStyle(style.Name)识别代码>可能重复的@Berkay它不是可能的重复,而是完全重复。我已经看到Jhon第三次发布这个问题了。嗨,我没有找到任何问题,所以我一次又一次地发布