Document doc = new Document();
Section section = doc.AddSection();
//添加一個段落
Paragraph para = section.AddParagraph();
para.AppendText("Test 哈哈哈");
//為段落設置樣式
ParagraphStyle paragraphStyle = doc.AddParagraphStyle("style1");
//設置段落字體為宋體
paragraphStyle.CharacterFormat.FontName = "宋体";
//設置字體大小
paragraphStyle.CharacterFormat.FontSize = 15f;
//應用樣式
para.ApplyStyle(paragraphStyle);
//設置段落對齊方式為居中對齊
para.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;