如何锁定缩进功能,以便任何需要第二行(或第三行或第四行等)文本的引用都在第一行下面缩进?段落缩进第一行,所有后续行都居中,这与此完全相反。
答案1
您可以将第一段设置为标题,并将其他段落设置为正文。
C# 代码如下:
//Create Document
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph
= section.Paragraphs.Count > 0 ? section.Paragraphs[0] : section.AddParagraph();
//Heading 1
paragraph = section.AddParagraph();
paragraph.AppendText(BuiltinStyle.Heading1.ToString());
paragraph.ApplyStyle(BuiltinStyle.Heading1);
paragraph.ListFormat.ApplyNumberedStyle();
//Heading 2
paragraph = section.AddParagraph();
paragraph.AppendText(BuiltinStyle.Heading2.ToString());
paragraph.ApplyStyle(BuiltinStyle.Heading2);
//Number Format(list) for Headings
ListStyle listSty2 = new ListStyle(document, ListType.Numbered);
foreach (ListLevel listLev in listSty2.Levels)
{
listLev.UsePrevLevelPattern = true;
listLev.NumberPrefix = “1.”;
}
listSty2.Name = “MyStyle2″;
document.ListStyles.Add(listSty2);
paragraph.ListFormat.ApplyStyle(listSty2.Name);
ListStyle listSty3 = new ListStyle(document, ListType.Numbered);
foreach (ListLevel listLev in listSty3.Levels)
{
listLev.UsePrevLevelPattern = true;
listLev.NumberPrefix = “1.1.”;
}
listSty3.Name = “MyStyle3″;
document.ListStyles.Add(listSty3);
//Heading 3
for (int i = 0; i < 4; i++)
{
paragraph = section.AddParagraph();
//Append Text
paragraph.AppendText(“Heading3″);
//Apply Style
paragraph.ApplyStyle(BuiltinStyle.Heading3);
paragraph.ListFormat.ApplyStyle(listSty3.Name);
}
我用的是.NET Word成分。