请问如何在一个文档新建的时候,对文档进行style初始化。比如增加标题1,标题2,标题3,正文等常用的样式。
下面是我的代码,但是加进去报错。
ParagraphStyle ps = new ParagraphStyle("标题1", "Normal");
ps.FontName = "宋体";
ps.FontSize=210;
ps.ParagraphFormat.Alignment = TXTextControl.HorizontalAlignment.Left;
ps.ParagraphFormat.HangingIndent = 0;
ps.ParagraphFormat.LeftIndent = 0;
ps.ParagraphFormat.LineSpacing = 150;
ps.ListFormat.FirstNumber = 1;
ps.ListFormat.HangingIndent = 0;
ps.ListFormat.LeftIndent = 0;
ps.ListFormat.Level = 1;
ps.ListFormat.NumberFormat = NumberFormat.ArabicNumbers;
ps.ListFormat.RestartNumbering = false;
ps.ListFormat.TextAfterNumber = "章";
ps.ListFormat.TextBeforeNumber = "第";
ps.ListFormat.Type = ListType.Numbered;
_textControl.ParagraphStyles.Add(ps);
|
|