标签:span add docx contents res com save rtp 创建目录
创建目录
效果图
static void AddToc() { Console.WriteLine("\tAddToc()"); using (var document = DocX.Create(@"docs\Toc2.docx")) { document.InsertTableOfContents("1 目录", TableOfContentsSwitches.O | TableOfContentsSwitches.U | TableOfContentsSwitches.Z | TableOfContentsSwitches.H, "Heading1"); // document.InsertSectionPageBreak();//分页 var h1 = document.InsertParagraph("2 测试1"); h1.StyleName = "Heading1"; document.InsertParagraph("Some very interesting content here"); var h2 = document.InsertParagraph("3 测试2"); h2.StyleName = "Heading1"; document.InsertParagraph("Some very interesting content here as well"); var h3 = document.InsertParagraph("3.1 测试3.1"); h3.StyleName = "Heading2"; var h4 = document.InsertParagraph("3.1.1 测试3.1.1"); h4.StyleName = "Heading3"; var h5 = document.InsertParagraph("4 测试4"); h5.StyleName = "Heading1"; document.InsertParagraph("Not so very interesting...."); document.Save(); } }
标签:span add docx contents res com save rtp 创建目录
原文地址:http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_csharp_005_docx2.html