Open Xml Sdk创建目录

在生成文档时要求生成,参考了玄魂的word目录页修正文章,链接

http://www.cnblogs.com/xuanhun/archive/2011/06/16/2083061.html

       word的目录是使用域来生成的,主要的标签即是HyperLink,在这里面要填充标题,目录项等。目录项是依赖标签项存在。如果要根据标题生成目录,要将每个标题上都添加bookmrak。

       所以首先第一步就是生成带有bookmark标题。并且设置对应的标题级别ParagraphStyleId,当文档内容生成玩了以后,开始找到所有的bookmark标签,和对应的ParagraphStyleId,根据这个生成相应的目录域插入的文档的头部。

 

       相关代码如下(没有对添加样式的代码进行优化,可以根据文档的内容动态生成相关的样式,特别是目录和标题的样式,必须在StyleDefinitionPart部分中添加,否则生成的内容没有样式)

   测试类:

    

View Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OContents
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = "D://testContents.docx";
            OpenWord ow = new OpenWord();
            ow.Init(fileName);
            ow.AddTitle("1.函数与极限",1);
            ow.AddTitle("1.1函数的基本概念", 2);
            ow.AddTitle("1.2函数的极限",2);
            ow.AddTitle("1.3两个重要极限", 2);
            ow.AddTitle("1.4函数的连续性和间断点", 2);
            ow.AddTitle("2.导数与微分", 1);
            ow.AddTitle("2.1导数的定义", 2);
            ow.AddTitle("2.2求导法则", 2);
            ow.AddTitle("2.3函数的微分及应用", 2);
            ow.AddTitle("3.导数的应用", 1);
            ow.AddTitle("3.1中值定理和洛必达法则", 2);
            ow.AddTitle("3.2函数的极限和最值", 2);
            ow.AddTitle("3.3曲面的凹凸性,拐点及函数应用", 2);
            ow.AddContents();
            ow.save();
        }
    }
}

 

   文档操作相关类

 

View Code
using W = DocumentFormat.OpenXml.Wordprocessing;
using M = DocumentFormat.OpenXml.Math;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml.Packaging;
using System.IO;
using DocumentFormat.OpenXml;

namespace OContents
{
    public class OpenWord
    {
        public WordprocessingDocument wDoc;
        public MainDocumentPart mainDoc;
        public W.Body body;
        public W.Document doc;

        public static int titleNum = 988888;
        public static string fontName = "微软雅黑";
        //四号字,对应word中的大小是10.5(Ps:这是openxml的一个不好之处就是,单位和word中显示的不一致)
        public static string fontSize = "21";
        //标题字体大小
        public static string titleFontSize = "24";
        /// <summary>
        /// 初始化文档
        /// </summary>
        /// <param name="fileName">创建文档的路径名称</param>
        public void Init(string fileName)
        {
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            wDoc = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document);
            mainDoc = wDoc.AddMainDocumentPart();
            doc = new W.Document();
            body = new W.Body();
        }



        /// <summary>
        /// 添加标题
        /// </summary>
        /// <param name="text">标题内容</param>
        /// <param name="level">标题等级</param>
        public void AddTitle(string text,int level)
        {
            titleNum++;
            W.Paragraph paragraph = new W.Paragraph();

            W.ParagraphProperties paragraphPraperties = new W.ParagraphProperties();
            W.ParagraphStyleId paragraphStyleId = new W.ParagraphStyleId() { Val = level.ToString() };
            //修饰段落
            W.ParagraphMarkRunProperties paragraphMarkRunProperties = new W.ParagraphMarkRunProperties();

            //字体
            W.RunFonts runFonts1 = new W.RunFonts() { Ascii = fontName, HighAnsi = fontName, EastAsia = fontName };
            //字的大小
            W.FontSize fontSize1 = new W.FontSize() { Val =OpenWord.fontSize };

            paragraphMarkRunProperties.Append(runFonts1);
            paragraphMarkRunProperties.Append(fontSize1);
            paragraphPraperties.Append(paragraphStyleId);
            paragraphPraperties.Append(paragraphMarkRunProperties);

            W.BookmarkStart bookmarkStart1 = new W.BookmarkStart() { Name = "_Toc" + titleNum, Id = titleNum.ToString() };

            W.Run run = new W.Run();

            W.RunProperties runProperties = new W.RunProperties();
            W.RunFonts runFonts = new W.RunFonts() { Hint = W.FontTypeHintValues.EastAsia, Ascii = fontName, HighAnsi = fontName, EastAsia = fontName };
            W.FontSize fontSize = new W.FontSize() { Val = titleFontSize };
            runProperties.Append(runFonts);
            runProperties.Append(fontSize);
            W.LastRenderedPageBreak lrp = new W.LastRenderedPageBreak();
            W.Text text1 = new W.Text();
            text1.Text = text;
            run.Append(runProperties);
            run.Append(lrp);
            run.Append(text1);

            W.BookmarkEnd bookmarkEnd1 = new W.BookmarkEnd { Id = titleNum.ToString() };

            paragraph.Append(paragraphPraperties);
            paragraph.Append(bookmarkStart1);
            paragraph.Append(run);
            paragraph.Append(bookmarkEnd1);

            body.Append(paragraph);
        }

        //添加目录
        public void AddContents()
        {
            List<W.Paragraph> paragrap = new List<W.Paragraph>();

            #region 查找到所有带有书签的段落
            IEnumerable<W.Paragraph> paraGraphs= body.Descendants<W.Paragraph>();
            foreach (W.Paragraph para in paraGraphs)
            {
                if (para.Elements<W.BookmarkStart>().Count() > 0)
                {
                    paragrap.Add(para);
                }
            }
            #endregion


            #region 根据查找到带有书签的标题,生成目录
            for (int i = 0; i < paragrap.Count; i++)
            {
                W.Paragraph oldParagraph = paragrap[i];
                W.BookmarkStart bs=oldParagraph.Descendants<W.BookmarkStart>().First();
                W.ParagraphStyleId ps = oldParagraph.Descendants<W.ParagraphStyleId>().First();
                W.Text oldText = oldParagraph.Descendants<W.Text>().First();

                
                #region 创建目录
                W.Paragraph newParagraph = new W.Paragraph();
                W.ParagraphProperties paragraphProperties1 = new W.ParagraphProperties();
                //假设标题对应的格式是标题1,则目录中应该为10
                W.ParagraphStyleId paragraphStyleId = new W.ParagraphStyleId() { Val=ps.Val+0};

                W.Tabs tabs1 = new W.Tabs();
                W.TabStop tapStop1 = new W.TabStop() { Val=W.TabStopValues.Right,Leader=W.TabStopLeaderCharValues.Dot,Position=8296};

                tabs1.Append(tapStop1);

                W.ParagraphMarkRunProperties paragraphMarkRunProtites = new W.ParagraphMarkRunProperties();
                W.NoProof noProof1 = new W.NoProof();

                paragraphMarkRunProtites.Append(noProof1);

                paragraphProperties1.Append(paragraphStyleId);
                paragraphProperties1.Append(tabs1);
                paragraphProperties1.Append(paragraphMarkRunProtites);


                W.Hyperlink hyperlink1 = new W.Hyperlink() { History = true, Anchor = bs.Name };

                W.Run run1 = new W.Run();

                W.RunProperties runProperties1 = new W.RunProperties();
                W.RunFonts runFonts1 = GenerateRunFonts(fontName);
                W.NoProof noProof2 = new W.NoProof();

                runProperties1.Append(runFonts1);
                runProperties1.Append(noProof2);
                W.Text text1 = new W.Text();
                text1.Text = oldText.Text;

                run1.Append(runProperties1);
                run1.Append(text1);

                W.Run run2 = new W.Run();

                W.RunProperties runProperties2 = new W.RunProperties();
                W.NoProof noProof3 = new W.NoProof();
                W.WebHidden webHidden1 = new W.WebHidden();

                runProperties2.Append(noProof3);
                runProperties2.Append(webHidden1);

                W.TabChar tabChar1 = new W.TabChar();
                run2.Append(runProperties2);
                run2.Append(tabChar1);


                W.Run run3 = new W.Run();

                W.RunProperties runProperties3 = new W.RunProperties();
                W.NoProof noProof4 = new W.NoProof();
                W.WebHidden webHidden2 = new W.WebHidden();
                runProperties3.Append(noProof4);
                runProperties3.Append(webHidden2);
                W.FieldChar fieldChar1 = new W.FieldChar() { FieldCharType=W.FieldCharValues.Begin};
                
                run3.Append(runProperties3);
                run3.Append(fieldChar1);


                W.Run run4 = new W.Run();

                W.RunProperties runProperties6 = new W.RunProperties();
                W.NoProof noProof6 = new W.NoProof();
                W.WebHidden webHidden3 = new W.WebHidden();

                runProperties6.Append(noProof6);
                runProperties6.Append(webHidden3);
                W.FieldCode fieldCode4 = new W.FieldCode() { Space = SpaceProcessingModeValues.Preserve };
                fieldCode4.Text = " PAGEREF " + bs.Name + "\\h";

                run4.Append(runProperties6);
                run4.Append(fieldCode4);

                W.Run run5 = new W.Run();

                W.RunProperties runProperties8 = new W.RunProperties();
                W.NoProof noProof8 = new W.NoProof();
                W.WebHidden webHidden5 = new W.WebHidden();

                runProperties8.Append(noProof8);
                runProperties8.Append(webHidden5);
                W.FieldChar fieldChar4 = new W.FieldChar() { FieldCharType = W.FieldCharValues.Separate };

                run5.Append(runProperties8);
                run5.Append(fieldChar4);

                W.Run run6 = new W.Run();

                W.RunProperties runProperties10 = new W.RunProperties();
                W.NoProof noProof10 = new W.NoProof();
                W.WebHidden webHidden7 = new W.WebHidden();

                runProperties10.Append(noProof10);
                runProperties10.Append(webHidden7);
                W.FieldChar fieldChar5 = new W.FieldChar() { FieldCharType = W.FieldCharValues.End };

                run6.Append(runProperties10);
                run6.Append(fieldChar5);


                hyperlink1.Append(run1);
                hyperlink1.Append(run2);
                hyperlink1.Append(run3);
                hyperlink1.Append(run4);
                hyperlink1.Append(run5);
                hyperlink1.Append(run6);
                newParagraph.Append(paragraphProperties1);
                if (i == 0)
                {
                    //目录是用域做出来的,所以这里首先添加目录域开始代码
                    AddCodeStart(newParagraph);
                }
                newParagraph.Append(hyperlink1);
                if (i == paragrap.Count - 1)
                {
                    //目录是用域做出来的,所以这里首先添加目录域结束代码
                    AddCodeEnd(newParagraph);
                }

                body.InsertAt<W.Paragraph>(newParagraph,i);
                #endregion

            }
            #endregion
        }

        private void AddCodeEnd(W.Paragraph newParagraph)
        {
            W.Run run = new W.Run();
            W.FieldChar fieldChar = new W.FieldChar() { FieldCharType = W.FieldCharValues.End };

            run.Append(fieldChar);

            W.Run run1 = new W.Run();
            W.Break break1 = new W.Break() { Type = W.BreakValues.Page };
            run1.Append(break1);

            newParagraph.Append(run);
            newParagraph.Append(run1);
        }

        private void AddCodeStart(W.Paragraph newParagraph)
        {
            W.Run run1 = new W.Run();
            W.FieldChar fieldChar1 = new W.FieldChar() { FieldCharType = W.FieldCharValues.Begin };

            run1.Append(fieldChar1);

            W.Run run2 = new W.Run();
            W.FieldCode fieldCode1 = new W.FieldCode() { Space = SpaceProcessingModeValues.Preserve };
            fieldCode1.Text = " ";

            run2.Append(fieldCode1);

            W.Run run3 = new W.Run();

            W.RunProperties runProperties1 = new W.RunProperties();
            W.RunFonts runFonts1 = GenerateRunFonts(fontName);

            runProperties1.Append(runFonts1);
            W.FieldCode fieldCode2 = new W.FieldCode();
            fieldCode2.Text = "TOC \\o \"1-3\" \\h \\z \\u";

            run3.Append(runProperties1);
            run3.Append(fieldCode2);

            W.Run run4 = new W.Run();
            W.FieldCode fieldCode3 = new W.FieldCode() { Space = SpaceProcessingModeValues.Preserve };
            fieldCode3.Text = " ";

            run4.Append(fieldCode3);

            W.Run run5 = new W.Run();
            W.FieldChar fieldChar2 = new W.FieldChar() { FieldCharType = W.FieldCharValues.Separate };

            run5.Append(fieldChar2);
            newParagraph.Append(run1);
            newParagraph.Append(run2);
            newParagraph.Append(run3);
            newParagraph.Append(run4);
            newParagraph.Append(run5);
        }

        private W.RunFonts GenerateRunFonts(string fontName)
        {
            W.RunFonts runFonts = new W.RunFonts() { Hint = W.FontTypeHintValues.EastAsia, Ascii = fontName, HighAnsi = fontName, EastAsia = fontName };
            return runFonts;
        }

        //样式定义(包含标题,页眉页脚等)
        public static void GenerateStyleDefinitionsPart1Content(DocumentFormat.OpenXml.Packaging.StyleDefinitionsPart styleDefinitionsPart)
        {
            W.Styles styles1 = new W.Styles();
            styles1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            styles1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");

            W.DocDefaults docDefaults1 = new W.DocDefaults();

            W.RunPropertiesDefault runPropertiesDefault1 = new W.RunPropertiesDefault();

            W.RunPropertiesBaseStyle runPropertiesBaseStyle1 = new W.RunPropertiesBaseStyle();
            W.RunFonts runFonts1 = new W.RunFonts() { AsciiTheme = W.ThemeFontValues.MinorHighAnsi, HighAnsiTheme = W.ThemeFontValues.MinorHighAnsi, EastAsiaTheme = W.ThemeFontValues.MinorEastAsia, ComplexScriptTheme = W.ThemeFontValues.MinorBidi };
            W.Kern kern1 = new W.Kern() { Val = (UInt32Value)2U };
            W.FontSize fontSize1 = new W.FontSize() { Val = "21" };
            W.FontSizeComplexScript fontSizeComplexScript1 = new W.FontSizeComplexScript() { Val = "22" };
            W.Languages languages1 = new W.Languages() { Val = "en-US", EastAsia = "zh-CN", Bidi = "ar-SA" };

            runPropertiesBaseStyle1.Append(runFonts1);
            runPropertiesBaseStyle1.Append(kern1);
            runPropertiesBaseStyle1.Append(fontSize1);
            runPropertiesBaseStyle1.Append(fontSizeComplexScript1);
            runPropertiesBaseStyle1.Append(languages1);

            runPropertiesDefault1.Append(runPropertiesBaseStyle1);
            W.ParagraphPropertiesDefault paragraphPropertiesDefault1 = new W.ParagraphPropertiesDefault();

            docDefaults1.Append(runPropertiesDefault1);
            docDefaults1.Append(paragraphPropertiesDefault1);

            W.LatentStyles latentStyles1 = new W.LatentStyles() { DefaultLockedState = false, DefaultUiPriority = 99, DefaultSemiHidden = true, DefaultUnhideWhenUsed = true, DefaultPrimaryStyle = false, Count = 267 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo1 = new W.LatentStyleExceptionInfo() { Name = "Normal", UiPriority = 0, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo2 = new W.LatentStyleExceptionInfo() { Name = "heading 1", UiPriority = 9, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo3 = new W.LatentStyleExceptionInfo() { Name = "heading 2", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo4 = new W.LatentStyleExceptionInfo() { Name = "heading 3", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo5 = new W.LatentStyleExceptionInfo() { Name = "heading 4", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo6 = new W.LatentStyleExceptionInfo() { Name = "heading 5", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo7 = new W.LatentStyleExceptionInfo() { Name = "heading 6", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo8 = new W.LatentStyleExceptionInfo() { Name = "heading 7", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo9 = new W.LatentStyleExceptionInfo() { Name = "heading 8", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo10 = new W.LatentStyleExceptionInfo() { Name = "heading 9", UiPriority = 9, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo11 = new W.LatentStyleExceptionInfo() { Name = "toc 1", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo12 = new W.LatentStyleExceptionInfo() { Name = "toc 2", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo13 = new W.LatentStyleExceptionInfo() { Name = "toc 3", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo14 = new W.LatentStyleExceptionInfo() { Name = "toc 4", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo15 = new W.LatentStyleExceptionInfo() { Name = "toc 5", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo16 = new W.LatentStyleExceptionInfo() { Name = "toc 6", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo17 = new W.LatentStyleExceptionInfo() { Name = "toc 7", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo18 = new W.LatentStyleExceptionInfo() { Name = "toc 8", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo19 = new W.LatentStyleExceptionInfo() { Name = "toc 9", UiPriority = 39 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo20 = new W.LatentStyleExceptionInfo() { Name = "caption", UiPriority = 35, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo21 = new W.LatentStyleExceptionInfo() { Name = "Title", UiPriority = 10, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo22 = new W.LatentStyleExceptionInfo() { Name = "Default Paragraph Font", UiPriority = 1 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo23 = new W.LatentStyleExceptionInfo() { Name = "Subtitle", UiPriority = 11, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo24 = new W.LatentStyleExceptionInfo() { Name = "Strong", UiPriority = 22, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo25 = new W.LatentStyleExceptionInfo() { Name = "Emphasis", UiPriority = 20, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo26 = new W.LatentStyleExceptionInfo() { Name = "Table Grid", UiPriority = 59, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo27 = new W.LatentStyleExceptionInfo() { Name = "Placeholder Text", UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo28 = new W.LatentStyleExceptionInfo() { Name = "No Spacing", UiPriority = 1, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo29 = new W.LatentStyleExceptionInfo() { Name = "Light Shading", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo30 = new W.LatentStyleExceptionInfo() { Name = "Light List", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo31 = new W.LatentStyleExceptionInfo() { Name = "Light Grid", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo32 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo33 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo34 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo35 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo36 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo37 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo38 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo39 = new W.LatentStyleExceptionInfo() { Name = "Dark List", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo40 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo41 = new W.LatentStyleExceptionInfo() { Name = "Colorful List", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo42 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo43 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 1", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo44 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 1", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo45 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 1", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo46 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 1", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo47 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 1", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo48 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 1", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo49 = new W.LatentStyleExceptionInfo() { Name = "Revision", UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo50 = new W.LatentStyleExceptionInfo() { Name = "List Paragraph", UiPriority = 34, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo51 = new W.LatentStyleExceptionInfo() { Name = "Quote", UiPriority = 29, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo52 = new W.LatentStyleExceptionInfo() { Name = "Intense Quote", UiPriority = 30, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo53 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 1", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo54 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 1", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo55 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 1", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo56 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 1", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo57 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 1", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo58 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 1", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo59 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 1", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo60 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 1", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo61 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 2", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo62 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 2", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo63 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 2", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo64 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 2", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo65 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 2", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo66 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 2", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo67 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 2", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo68 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 2", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo69 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 2", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo70 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 2", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo71 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 2", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo72 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 2", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo73 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 2", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo74 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 2", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo75 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 3", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo76 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 3", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo77 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 3", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo78 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 3", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo79 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 3", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo80 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 3", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo81 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 3", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo82 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 3", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo83 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 3", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo84 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 3", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo85 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 3", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo86 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 3", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo87 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 3", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo88 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 3", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo89 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 4", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo90 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 4", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo91 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 4", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo92 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 4", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo93 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 4", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo94 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 4", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo95 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 4", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo96 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 4", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo97 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 4", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo98 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 4", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo99 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 4", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo100 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 4", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo101 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 4", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo102 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 4", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo103 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 5", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo104 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 5", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo105 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 5", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo106 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 5", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo107 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 5", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo108 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 5", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo109 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 5", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo110 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 5", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo111 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 5", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo112 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 5", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo113 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 5", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo114 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 5", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo115 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 5", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo116 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 5", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo117 = new W.LatentStyleExceptionInfo() { Name = "Light Shading Accent 6", UiPriority = 60, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo118 = new W.LatentStyleExceptionInfo() { Name = "Light List Accent 6", UiPriority = 61, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo119 = new W.LatentStyleExceptionInfo() { Name = "Light Grid Accent 6", UiPriority = 62, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo120 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 1 Accent 6", UiPriority = 63, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo121 = new W.LatentStyleExceptionInfo() { Name = "Medium Shading 2 Accent 6", UiPriority = 64, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo122 = new W.LatentStyleExceptionInfo() { Name = "Medium List 1 Accent 6", UiPriority = 65, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo123 = new W.LatentStyleExceptionInfo() { Name = "Medium List 2 Accent 6", UiPriority = 66, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo124 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 1 Accent 6", UiPriority = 67, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo125 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 2 Accent 6", UiPriority = 68, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo126 = new W.LatentStyleExceptionInfo() { Name = "Medium Grid 3 Accent 6", UiPriority = 69, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo127 = new W.LatentStyleExceptionInfo() { Name = "Dark List Accent 6", UiPriority = 70, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo128 = new W.LatentStyleExceptionInfo() { Name = "Colorful Shading Accent 6", UiPriority = 71, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo129 = new W.LatentStyleExceptionInfo() { Name = "Colorful List Accent 6", UiPriority = 72, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo130 = new W.LatentStyleExceptionInfo() { Name = "Colorful Grid Accent 6", UiPriority = 73, SemiHidden = false, UnhideWhenUsed = false };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo131 = new W.LatentStyleExceptionInfo() { Name = "Subtle Emphasis", UiPriority = 19, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo132 = new W.LatentStyleExceptionInfo() { Name = "Intense Emphasis", UiPriority = 21, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo133 = new W.LatentStyleExceptionInfo() { Name = "Subtle Reference", UiPriority = 31, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo134 = new W.LatentStyleExceptionInfo() { Name = "Intense Reference", UiPriority = 32, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo135 = new W.LatentStyleExceptionInfo() { Name = "Book Title", UiPriority = 33, SemiHidden = false, UnhideWhenUsed = false, PrimaryStyle = true };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo136 = new W.LatentStyleExceptionInfo() { Name = "Bibliography", UiPriority = 37 };
            W.LatentStyleExceptionInfo latentStyleExceptionInfo137 = new W.LatentStyleExceptionInfo() { Name = "TOC Heading", UiPriority = 39, PrimaryStyle = true };

            latentStyles1.Append(latentStyleExceptionInfo1);
            latentStyles1.Append(latentStyleExceptionInfo2);
            latentStyles1.Append(latentStyleExceptionInfo3);
            latentStyles1.Append(latentStyleExceptionInfo4);
            latentStyles1.Append(latentStyleExceptionInfo5);
            latentStyles1.Append(latentStyleExceptionInfo6);
            latentStyles1.Append(latentStyleExceptionInfo7);
            latentStyles1.Append(latentStyleExceptionInfo8);
            latentStyles1.Append(latentStyleExceptionInfo9);
            latentStyles1.Append(latentStyleExceptionInfo10);
            latentStyles1.Append(latentStyleExceptionInfo11);
            latentStyles1.Append(latentStyleExceptionInfo12);
            latentStyles1.Append(latentStyleExceptionInfo13);
            latentStyles1.Append(latentStyleExceptionInfo14);
            latentStyles1.Append(latentStyleExceptionInfo15);
            latentStyles1.Append(latentStyleExceptionInfo16);
            latentStyles1.Append(latentStyleExceptionInfo17);
            latentStyles1.Append(latentStyleExceptionInfo18);
            latentStyles1.Append(latentStyleExceptionInfo19);
            latentStyles1.Append(latentStyleExceptionInfo20);
            latentStyles1.Append(latentStyleExceptionInfo21);
            latentStyles1.Append(latentStyleExceptionInfo22);
            latentStyles1.Append(latentStyleExceptionInfo23);
            latentStyles1.Append(latentStyleExceptionInfo24);
            latentStyles1.Append(latentStyleExceptionInfo25);
            latentStyles1.Append(latentStyleExceptionInfo26);
            latentStyles1.Append(latentStyleExceptionInfo27);
            latentStyles1.Append(latentStyleExceptionInfo28);
            latentStyles1.Append(latentStyleExceptionInfo29);
            latentStyles1.Append(latentStyleExceptionInfo30);
            latentStyles1.Append(latentStyleExceptionInfo31);
            latentStyles1.Append(latentStyleExceptionInfo32);
            latentStyles1.Append(latentStyleExceptionInfo33);
            latentStyles1.Append(latentStyleExceptionInfo34);
            latentStyles1.Append(latentStyleExceptionInfo35);
            latentStyles1.Append(latentStyleExceptionInfo36);
            latentStyles1.Append(latentStyleExceptionInfo37);
            latentStyles1.Append(latentStyleExceptionInfo38);
            latentStyles1.Append(latentStyleExceptionInfo39);
            latentStyles1.Append(latentStyleExceptionInfo40);
            latentStyles1.Append(latentStyleExceptionInfo41);
            latentStyles1.Append(latentStyleExceptionInfo42);
            latentStyles1.Append(latentStyleExceptionInfo43);
            latentStyles1.Append(latentStyleExceptionInfo44);
            latentStyles1.Append(latentStyleExceptionInfo45);
            latentStyles1.Append(latentStyleExceptionInfo46);
            latentStyles1.Append(latentStyleExceptionInfo47);
            latentStyles1.Append(latentStyleExceptionInfo48);
            latentStyles1.Append(latentStyleExceptionInfo49);
            latentStyles1.Append(latentStyleExceptionInfo50);
            latentStyles1.Append(latentStyleExceptionInfo51);
            latentStyles1.Append(latentStyleExceptionInfo52);
            latentStyles1.Append(latentStyleExceptionInfo53);
            latentStyles1.Append(latentStyleExceptionInfo54);
            latentStyles1.Append(latentStyleExceptionInfo55);
            latentStyles1.Append(latentStyleExceptionInfo56);
            latentStyles1.Append(latentStyleExceptionInfo57);
            latentStyles1.Append(latentStyleExceptionInfo58);
            latentStyles1.Append(latentStyleExceptionInfo59);
            latentStyles1.Append(latentStyleExceptionInfo60);
            latentStyles1.Append(latentStyleExceptionInfo61);
            latentStyles1.Append(latentStyleExceptionInfo62);
            latentStyles1.Append(latentStyleExceptionInfo63);
            latentStyles1.Append(latentStyleExceptionInfo64);
            latentStyles1.Append(latentStyleExceptionInfo65);
            latentStyles1.Append(latentStyleExceptionInfo66);
            latentStyles1.Append(latentStyleExceptionInfo67);
            latentStyles1.Append(latentStyleExceptionInfo68);
            latentStyles1.Append(latentStyleExceptionInfo69);
            latentStyles1.Append(latentStyleExceptionInfo70);
            latentStyles1.Append(latentStyleExceptionInfo71);
            latentStyles1.Append(latentStyleExceptionInfo72);
            latentStyles1.Append(latentStyleExceptionInfo73);
            latentStyles1.Append(latentStyleExceptionInfo74);
            latentStyles1.Append(latentStyleExceptionInfo75);
            latentStyles1.Append(latentStyleExceptionInfo76);
            latentStyles1.Append(latentStyleExceptionInfo77);
            latentStyles1.Append(latentStyleExceptionInfo78);
            latentStyles1.Append(latentStyleExceptionInfo79);
            latentStyles1.Append(latentStyleExceptionInfo80);
            latentStyles1.Append(latentStyleExceptionInfo81);
            latentStyles1.Append(latentStyleExceptionInfo82);
            latentStyles1.Append(latentStyleExceptionInfo83);
            latentStyles1.Append(latentStyleExceptionInfo84);
            latentStyles1.Append(latentStyleExceptionInfo85);
            latentStyles1.Append(latentStyleExceptionInfo86);
            latentStyles1.Append(latentStyleExceptionInfo87);
            latentStyles1.Append(latentStyleExceptionInfo88);
            latentStyles1.Append(latentStyleExceptionInfo89);
            latentStyles1.Append(latentStyleExceptionInfo90);
            latentStyles1.Append(latentStyleExceptionInfo91);
            latentStyles1.Append(latentStyleExceptionInfo92);
            latentStyles1.Append(latentStyleExceptionInfo93);
            latentStyles1.Append(latentStyleExceptionInfo94);
            latentStyles1.Append(latentStyleExceptionInfo95);
            latentStyles1.Append(latentStyleExceptionInfo96);
            latentStyles1.Append(latentStyleExceptionInfo97);
            latentStyles1.Append(latentStyleExceptionInfo98);
            latentStyles1.Append(latentStyleExceptionInfo99);
            latentStyles1.Append(latentStyleExceptionInfo100);
            latentStyles1.Append(latentStyleExceptionInfo101);
            latentStyles1.Append(latentStyleExceptionInfo102);
            latentStyles1.Append(latentStyleExceptionInfo103);
            latentStyles1.Append(latentStyleExceptionInfo104);
            latentStyles1.Append(latentStyleExceptionInfo105);
            latentStyles1.Append(latentStyleExceptionInfo106);
            latentStyles1.Append(latentStyleExceptionInfo107);
            latentStyles1.Append(latentStyleExceptionInfo108);
            latentStyles1.Append(latentStyleExceptionInfo109);
            latentStyles1.Append(latentStyleExceptionInfo110);
            latentStyles1.Append(latentStyleExceptionInfo111);
            latentStyles1.Append(latentStyleExceptionInfo112);
            latentStyles1.Append(latentStyleExceptionInfo113);
            latentStyles1.Append(latentStyleExceptionInfo114);
            latentStyles1.Append(latentStyleExceptionInfo115);
            latentStyles1.Append(latentStyleExceptionInfo116);
            latentStyles1.Append(latentStyleExceptionInfo117);
            latentStyles1.Append(latentStyleExceptionInfo118);
            latentStyles1.Append(latentStyleExceptionInfo119);
            latentStyles1.Append(latentStyleExceptionInfo120);
            latentStyles1.Append(latentStyleExceptionInfo121);
            latentStyles1.Append(latentStyleExceptionInfo122);
            latentStyles1.Append(latentStyleExceptionInfo123);
            latentStyles1.Append(latentStyleExceptionInfo124);
            latentStyles1.Append(latentStyleExceptionInfo125);
            latentStyles1.Append(latentStyleExceptionInfo126);
            latentStyles1.Append(latentStyleExceptionInfo127);
            latentStyles1.Append(latentStyleExceptionInfo128);
            latentStyles1.Append(latentStyleExceptionInfo129);
            latentStyles1.Append(latentStyleExceptionInfo130);
            latentStyles1.Append(latentStyleExceptionInfo131);
            latentStyles1.Append(latentStyleExceptionInfo132);
            latentStyles1.Append(latentStyleExceptionInfo133);
            latentStyles1.Append(latentStyleExceptionInfo134);
            latentStyles1.Append(latentStyleExceptionInfo135);
            latentStyles1.Append(latentStyleExceptionInfo136);
            latentStyles1.Append(latentStyleExceptionInfo137);

            W.Style style1 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "a", Default = true };
            W.StyleName styleName1 = new W.StyleName() { Val = "Normal" };
            W.PrimaryStyle primaryStyle1 = new W.PrimaryStyle();

            W.StyleParagraphProperties styleParagraphProperties1 = new W.StyleParagraphProperties();
            W.WidowControl widowControl1 = new W.WidowControl() { Val = false };
            W.Justification justification1 = new W.Justification() { Val = W.JustificationValues.Left };

            styleParagraphProperties1.Append(widowControl1);
            styleParagraphProperties1.Append(justification1);

            style1.Append(styleName1);
            style1.Append(primaryStyle1);
            style1.Append(styleParagraphProperties1);

            W.Style style2 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "1" };
            W.StyleName styleName2 = new W.StyleName() { Val = "heading 1" };
            W.BasedOn basedOn1 = new W.BasedOn() { Val = "a" };
            W.NextParagraphStyle nextParagraphStyle1 = new W.NextParagraphStyle() { Val = "a" };
            W.LinkedStyle linkedStyle1 = new W.LinkedStyle() { Val = "1Char" };
            W.UIPriority uIPriority1 = new W.UIPriority() { Val = 9 };
            W.PrimaryStyle primaryStyle2 = new W.PrimaryStyle();
            W.Rsid rsid1 = new W.Rsid() { Val = "00861388" };

            W.StyleParagraphProperties styleParagraphProperties2 = new W.StyleParagraphProperties();
            W.KeepNext keepNext1 = new W.KeepNext();
            W.KeepLines keepLines1 = new W.KeepLines();
            W.SpacingBetweenLines spacingBetweenLines1 = new W.SpacingBetweenLines() { Before = "340", After = "330", Line = "578", LineRule = W.LineSpacingRuleValues.Auto };
            W.OutlineLevel outlineLevel1 = new W.OutlineLevel() { Val = 0 };

            styleParagraphProperties2.Append(keepNext1);
            styleParagraphProperties2.Append(keepLines1);
            styleParagraphProperties2.Append(spacingBetweenLines1);
            styleParagraphProperties2.Append(outlineLevel1);

            W.StyleRunProperties styleRunProperties1 = new W.StyleRunProperties();
            W.Bold bold1 = new W.Bold();
            W.BoldComplexScript boldComplexScript1 = new W.BoldComplexScript();
            W.Kern kern2 = new W.Kern() { Val = (UInt32Value)44U };
            W.FontSize fontSize2 = new W.FontSize() { Val = "44" };
            W.FontSizeComplexScript fontSizeComplexScript2 = new W.FontSizeComplexScript() { Val = "44" };

            styleRunProperties1.Append(bold1);
            styleRunProperties1.Append(boldComplexScript1);
            styleRunProperties1.Append(kern2);
            styleRunProperties1.Append(fontSize2);
            styleRunProperties1.Append(fontSizeComplexScript2);

            style2.Append(styleName2);
            style2.Append(basedOn1);
            style2.Append(nextParagraphStyle1);
            style2.Append(linkedStyle1);
            style2.Append(uIPriority1);
            style2.Append(primaryStyle2);
            style2.Append(rsid1);
            style2.Append(styleParagraphProperties2);
            style2.Append(styleRunProperties1);

            W.Style style3 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "2" };
            W.StyleName styleName3 = new W.StyleName() { Val = "heading 2" };
            W.BasedOn basedOn2 = new W.BasedOn() { Val = "a" };
            W.NextParagraphStyle nextParagraphStyle2 = new W.NextParagraphStyle() { Val = "a" };
            W.LinkedStyle linkedStyle2 = new W.LinkedStyle() { Val = "2Char" };
            W.UIPriority uIPriority2 = new W.UIPriority() { Val = 9 };
            W.UnhideWhenUsed unhideWhenUsed1 = new W.UnhideWhenUsed();
            W.PrimaryStyle primaryStyle3 = new W.PrimaryStyle();
            W.Rsid rsid2 = new W.Rsid() { Val = "00853401" };

            W.StyleParagraphProperties styleParagraphProperties3 = new W.StyleParagraphProperties();
            W.KeepNext keepNext2 = new W.KeepNext();
            W.KeepLines keepLines2 = new W.KeepLines();
            W.SpacingBetweenLines spacingBetweenLines2 = new W.SpacingBetweenLines() { Before = "260", After = "260", Line = "416", LineRule = W.LineSpacingRuleValues.Auto };
            W.OutlineLevel outlineLevel2 = new W.OutlineLevel() { Val = 1 };

            styleParagraphProperties3.Append(keepNext2);
            styleParagraphProperties3.Append(keepLines2);
            styleParagraphProperties3.Append(spacingBetweenLines2);
            styleParagraphProperties3.Append(outlineLevel2);

            W.StyleRunProperties styleRunProperties2 = new W.StyleRunProperties();
            W.RunFonts runFonts2 = new W.RunFonts() { AsciiTheme = W.ThemeFontValues.MajorHighAnsi, HighAnsiTheme = W.ThemeFontValues.MajorHighAnsi, EastAsiaTheme = W.ThemeFontValues.MajorEastAsia, ComplexScriptTheme = W.ThemeFontValues.MajorBidi };
            W.Bold bold2 = new W.Bold();
            W.BoldComplexScript boldComplexScript2 = new W.BoldComplexScript();
            W.FontSize fontSize3 = new W.FontSize() { Val = "32" };
            W.FontSizeComplexScript fontSizeComplexScript3 = new W.FontSizeComplexScript() { Val = "32" };

            styleRunProperties2.Append(runFonts2);
            styleRunProperties2.Append(bold2);
            styleRunProperties2.Append(boldComplexScript2);
            styleRunProperties2.Append(fontSize3);
            styleRunProperties2.Append(fontSizeComplexScript3);

            style3.Append(styleName3);
            style3.Append(basedOn2);
            style3.Append(nextParagraphStyle2);
            style3.Append(linkedStyle2);
            style3.Append(uIPriority2);
            style3.Append(unhideWhenUsed1);
            style3.Append(primaryStyle3);
            style3.Append(rsid2);
            style3.Append(styleParagraphProperties3);
            style3.Append(styleRunProperties2);

            W.Style style4 = new W.Style() { Type = W.StyleValues.Character, StyleId = "a0", Default = true };
            W.StyleName styleName4 = new W.StyleName() { Val = "Default Paragraph Font" };
            W.UIPriority uIPriority3 = new W.UIPriority() { Val = 1 };
            W.SemiHidden semiHidden1 = new W.SemiHidden();
            W.UnhideWhenUsed unhideWhenUsed2 = new W.UnhideWhenUsed();

            style4.Append(styleName4);
            style4.Append(uIPriority3);
            style4.Append(semiHidden1);
            style4.Append(unhideWhenUsed2);

            W.Style style5 = new W.Style() { Type = W.StyleValues.Table, StyleId = "a1", Default = true };
            W.StyleName styleName5 = new W.StyleName() { Val = "Normal Table" };
            W.UIPriority uIPriority4 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden2 = new W.SemiHidden();
            W.UnhideWhenUsed unhideWhenUsed3 = new W.UnhideWhenUsed();
            W.PrimaryStyle primaryStyle4 = new W.PrimaryStyle();

            W.StyleTableProperties styleTableProperties1 = new W.StyleTableProperties();
            W.TableIndentation tableIndentation1 = new W.TableIndentation() { Width = 0, Type = W.TableWidthUnitValues.Dxa };

            W.TableCellMarginDefault tableCellMarginDefault1 = new W.TableCellMarginDefault();
            W.TopMargin topMargin1 = new W.TopMargin() { Width = "0", Type = W.TableWidthUnitValues.Dxa };
            W.TableCellLeftMargin tableCellLeftMargin1 = new W.TableCellLeftMargin() { Width = 108, Type = W.TableWidthValues.Dxa };
            W.BottomMargin bottomMargin1 = new W.BottomMargin() { Width = "0", Type = W.TableWidthUnitValues.Dxa };
            W.TableCellRightMargin tableCellRightMargin1 = new W.TableCellRightMargin() { Width = 108, Type = W.TableWidthValues.Dxa };

            tableCellMarginDefault1.Append(topMargin1);
            tableCellMarginDefault1.Append(tableCellLeftMargin1);
            tableCellMarginDefault1.Append(bottomMargin1);
            tableCellMarginDefault1.Append(tableCellRightMargin1);

            styleTableProperties1.Append(tableIndentation1);
            styleTableProperties1.Append(tableCellMarginDefault1);

            style5.Append(styleName5);
            style5.Append(uIPriority4);
            style5.Append(semiHidden2);
            style5.Append(unhideWhenUsed3);
            style5.Append(primaryStyle4);
            style5.Append(styleTableProperties1);

            W.Style style6 = new W.Style() { Type = W.StyleValues.Numbering, StyleId = "a2", Default = true };
            W.StyleName styleName6 = new W.StyleName() { Val = "No List" };
            W.UIPriority uIPriority5 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden3 = new W.SemiHidden();
            W.UnhideWhenUsed unhideWhenUsed4 = new W.UnhideWhenUsed();

            style6.Append(styleName6);
            style6.Append(uIPriority5);
            style6.Append(semiHidden3);
            style6.Append(unhideWhenUsed4);

            W.Style style7 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "a3" };
            W.StyleName styleName7 = new W.StyleName() { Val = "header" };
            W.BasedOn basedOn3 = new W.BasedOn() { Val = "a" };
            W.LinkedStyle linkedStyle3 = new W.LinkedStyle() { Val = "Char" };
            W.UIPriority uIPriority6 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden4 = new W.SemiHidden();
            W.UnhideWhenUsed unhideWhenUsed5 = new W.UnhideWhenUsed();
            W.Rsid rsid3 = new W.Rsid() { Val = "00861388" };

            W.StyleParagraphProperties styleParagraphProperties4 = new W.StyleParagraphProperties();

            W.ParagraphBorders paragraphBorders1 = new W.ParagraphBorders();
            W.BottomBorder bottomBorder1 = new W.BottomBorder() { Val = W.BorderValues.Single, Color = "auto", Size = (UInt32Value)6U, Space = (UInt32Value)1U };

            paragraphBorders1.Append(bottomBorder1);

            W.Tabs tabs1 = new W.Tabs();
            W.TabStop tabStop1 = new W.TabStop() { Val = W.TabStopValues.Center, Position = 4153 };
            W.TabStop tabStop2 = new W.TabStop() { Val = W.TabStopValues.Right, Position = 8306 };

            tabs1.Append(tabStop1);
            tabs1.Append(tabStop2);
            W.SnapToGrid snapToGrid1 = new W.SnapToGrid() { Val = false };
            W.Justification justification2 = new W.Justification() { Val = W.JustificationValues.Center };

            styleParagraphProperties4.Append(paragraphBorders1);
            styleParagraphProperties4.Append(tabs1);
            styleParagraphProperties4.Append(snapToGrid1);
            styleParagraphProperties4.Append(justification2);

            W.StyleRunProperties styleRunProperties3 = new W.StyleRunProperties();
            W.FontSize fontSize4 = new W.FontSize() { Val = "18" };
            W.FontSizeComplexScript fontSizeComplexScript4 = new W.FontSizeComplexScript() { Val = "18" };

            styleRunProperties3.Append(fontSize4);
            styleRunProperties3.Append(fontSizeComplexScript4);

            style7.Append(styleName7);
            style7.Append(basedOn3);
            style7.Append(linkedStyle3);
            style7.Append(uIPriority6);
            style7.Append(semiHidden4);
            style7.Append(unhideWhenUsed5);
            style7.Append(rsid3);
            style7.Append(styleParagraphProperties4);
            style7.Append(styleRunProperties3);

            W.Style style8 = new W.Style() { Type = W.StyleValues.Character, StyleId = "Char", CustomStyle = true };
            W.StyleName styleName8 = new W.StyleName() { Val = "页眉 Char" };
            W.BasedOn basedOn4 = new W.BasedOn() { Val = "a0" };
            W.LinkedStyle linkedStyle4 = new W.LinkedStyle() { Val = "a3" };
            W.UIPriority uIPriority7 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden5 = new W.SemiHidden();
            W.Rsid rsid4 = new W.Rsid() { Val = "00861388" };

            W.StyleRunProperties styleRunProperties4 = new W.StyleRunProperties();
            W.FontSize fontSize5 = new W.FontSize() { Val = "18" };
            W.FontSizeComplexScript fontSizeComplexScript5 = new W.FontSizeComplexScript() { Val = "18" };

            styleRunProperties4.Append(fontSize5);
            styleRunProperties4.Append(fontSizeComplexScript5);

            style8.Append(styleName8);
            style8.Append(basedOn4);
            style8.Append(linkedStyle4);
            style8.Append(uIPriority7);
            style8.Append(semiHidden5);
            style8.Append(rsid4);
            style8.Append(styleRunProperties4);

            W.Style style9 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "a4" };
            W.StyleName styleName9 = new W.StyleName() { Val = "footer" };
            W.BasedOn basedOn5 = new W.BasedOn() { Val = "a" };
            W.LinkedStyle linkedStyle5 = new W.LinkedStyle() { Val = "Char0" };
            W.UIPriority uIPriority8 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden6 = new W.SemiHidden();
            W.UnhideWhenUsed unhideWhenUsed6 = new W.UnhideWhenUsed();
            W.Rsid rsid5 = new W.Rsid() { Val = "00861388" };

            W.StyleParagraphProperties styleParagraphProperties5 = new W.StyleParagraphProperties();

            W.Tabs tabs2 = new W.Tabs();
            W.TabStop tabStop3 = new W.TabStop() { Val = W.TabStopValues.Center, Position = 4153 };
            W.TabStop tabStop4 = new W.TabStop() { Val = W.TabStopValues.Right, Position = 8306 };

            tabs2.Append(tabStop3);
            tabs2.Append(tabStop4);
            W.SnapToGrid snapToGrid2 = new W.SnapToGrid() { Val = false };
            W.Justification justification3 = new W.Justification() { Val = W.JustificationValues.Left };

            styleParagraphProperties5.Append(tabs2);
            styleParagraphProperties5.Append(snapToGrid2);
            styleParagraphProperties5.Append(justification3);

            W.StyleRunProperties styleRunProperties5 = new W.StyleRunProperties();
            W.FontSize fontSize6 = new W.FontSize() { Val = "18" };
            W.FontSizeComplexScript fontSizeComplexScript6 = new W.FontSizeComplexScript() { Val = "18" };

            styleRunProperties5.Append(fontSize6);
            styleRunProperties5.Append(fontSizeComplexScript6);

            style9.Append(styleName9);
            style9.Append(basedOn5);
            style9.Append(linkedStyle5);
            style9.Append(uIPriority8);
            style9.Append(semiHidden6);
            style9.Append(unhideWhenUsed6);
            style9.Append(rsid5);
            style9.Append(styleParagraphProperties5);
            style9.Append(styleRunProperties5);

            W.Style style10 = new W.Style() { Type = W.StyleValues.Character, StyleId = "Char0", CustomStyle = true };
            W.StyleName styleName10 = new W.StyleName() { Val = "页脚 Char" };
            W.BasedOn basedOn6 = new W.BasedOn() { Val = "a0" };
            W.LinkedStyle linkedStyle6 = new W.LinkedStyle() { Val = "a4" };
            W.UIPriority uIPriority9 = new W.UIPriority() { Val = 99 };
            W.SemiHidden semiHidden7 = new W.SemiHidden();
            W.Rsid rsid6 = new W.Rsid() { Val = "00861388" };

            W.StyleRunProperties styleRunProperties6 = new W.StyleRunProperties();
            W.FontSize fontSize7 = new W.FontSize() { Val = "18" };
            W.FontSizeComplexScript fontSizeComplexScript7 = new W.FontSizeComplexScript() { Val = "18" };

            styleRunProperties6.Append(fontSize7);
            styleRunProperties6.Append(fontSizeComplexScript7);

            style10.Append(styleName10);
            style10.Append(basedOn6);
            style10.Append(linkedStyle6);
            style10.Append(uIPriority9);
            style10.Append(semiHidden7);
            style10.Append(rsid6);
            style10.Append(styleRunProperties6);

            W.Style style11 = new W.Style() { Type = W.StyleValues.Character, StyleId = "1Char", CustomStyle = true };
            W.StyleName styleName11 = new W.StyleName() { Val = "标题 1 Char" };
            W.BasedOn basedOn7 = new W.BasedOn() { Val = "a0" };
            W.LinkedStyle linkedStyle7 = new W.LinkedStyle() { Val = "1" };
            W.UIPriority uIPriority10 = new W.UIPriority() { Val = 9 };
            W.Rsid rsid7 = new W.Rsid() { Val = "00861388" };

            W.StyleRunProperties styleRunProperties7 = new W.StyleRunProperties();
            W.Bold bold3 = new W.Bold();
            W.BoldComplexScript boldComplexScript3 = new W.BoldComplexScript();
            W.Kern kern3 = new W.Kern() { Val = (UInt32Value)44U };
            W.FontSize fontSize8 = new W.FontSize() { Val = "44" };
            W.FontSizeComplexScript fontSizeComplexScript8 = new W.FontSizeComplexScript() { Val = "44" };

            styleRunProperties7.Append(bold3);
            styleRunProperties7.Append(boldComplexScript3);
            styleRunProperties7.Append(kern3);
            styleRunProperties7.Append(fontSize8);
            styleRunProperties7.Append(fontSizeComplexScript8);

            style11.Append(styleName11);
            style11.Append(basedOn7);
            style11.Append(linkedStyle7);
            style11.Append(uIPriority10);
            style11.Append(rsid7);
            style11.Append(styleRunProperties7);

            W.Style style12 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "a5" };
            W.StyleName styleName12 = new W.StyleName() { Val = "List Paragraph" };
            W.BasedOn basedOn8 = new W.BasedOn() { Val = "a" };
            W.UIPriority uIPriority11 = new W.UIPriority() { Val = 34 };
            W.PrimaryStyle primaryStyle5 = new W.PrimaryStyle();
            W.Rsid rsid8 = new W.Rsid() { Val = "00853401" };

            W.StyleParagraphProperties styleParagraphProperties6 = new W.StyleParagraphProperties();
            W.Indentation indentation1 = new W.Indentation() { FirstLine = "420", FirstLineChars = 200 };

            styleParagraphProperties6.Append(indentation1);

            style12.Append(styleName12);
            style12.Append(basedOn8);
            style12.Append(uIPriority11);
            style12.Append(primaryStyle5);
            style12.Append(rsid8);
            style12.Append(styleParagraphProperties6);

            W.Style style13 = new W.Style() { Type = W.StyleValues.Character, StyleId = "2Char", CustomStyle = true };
            W.StyleName styleName13 = new W.StyleName() { Val = "标题 2 Char" };
            W.BasedOn basedOn9 = new W.BasedOn() { Val = "a0" };
            W.LinkedStyle linkedStyle8 = new W.LinkedStyle() { Val = "2" };
            W.UIPriority uIPriority12 = new W.UIPriority() { Val = 9 };
            W.Rsid rsid9 = new W.Rsid() { Val = "00853401" };

            W.StyleRunProperties styleRunProperties8 = new W.StyleRunProperties();
            W.RunFonts runFonts3 = new W.RunFonts() { AsciiTheme = W.ThemeFontValues.MajorHighAnsi, HighAnsiTheme = W.ThemeFontValues.MajorHighAnsi, EastAsiaTheme = W.ThemeFontValues.MajorEastAsia, ComplexScriptTheme = W.ThemeFontValues.MajorBidi };
            W.Bold bold4 = new W.Bold();
            W.BoldComplexScript boldComplexScript4 = new W.BoldComplexScript();
            W.FontSize fontSize9 = new W.FontSize() { Val = "32" };
            W.FontSizeComplexScript fontSizeComplexScript9 = new W.FontSizeComplexScript() { Val = "32" };

            styleRunProperties8.Append(runFonts3);
            styleRunProperties8.Append(bold4);
            styleRunProperties8.Append(boldComplexScript4);
            styleRunProperties8.Append(fontSize9);
            styleRunProperties8.Append(fontSizeComplexScript9);

            style13.Append(styleName13);
            style13.Append(basedOn9);
            style13.Append(linkedStyle8);
            style13.Append(uIPriority12);
            style13.Append(rsid9);
            style13.Append(styleRunProperties8);

            W.Style style14 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "10" };
            W.StyleName styleName14 = new W.StyleName() { Val = "toc 1" };
            W.BasedOn basedOn10 = new W.BasedOn() { Val = "a" };
            W.NextParagraphStyle nextParagraphStyle3 = new W.NextParagraphStyle() { Val = "a" };
            W.AutoRedefine autoRedefine1 = new W.AutoRedefine();
            W.UIPriority uIPriority13 = new W.UIPriority() { Val = 39 };
            W.UnhideWhenUsed unhideWhenUsed7 = new W.UnhideWhenUsed();
            W.Rsid rsid10 = new W.Rsid() { Val = "00853401" };

            style14.Append(styleName14);
            style14.Append(basedOn10);
            style14.Append(nextParagraphStyle3);
            style14.Append(autoRedefine1);
            style14.Append(uIPriority13);
            style14.Append(unhideWhenUsed7);
            style14.Append(rsid10);

            W.Style style15 = new W.Style() { Type = W.StyleValues.Paragraph, StyleId = "20" };
            W.StyleName styleName15 = new W.StyleName() { Val = "toc 2" };
            W.BasedOn basedOn11 = new W.BasedOn() { Val = "a" };
            W.NextParagraphStyle nextParagraphStyle4 = new W.NextParagraphStyle() { Val = "a" };
            W.AutoRedefine autoRedefine2 = new W.AutoRedefine();
            W.UIPriority uIPriority14 = new W.UIPriority() { Val = 39 };
            W.UnhideWhenUsed unhideWhenUsed8 = new W.UnhideWhenUsed();
            W.Rsid rsid11 = new W.Rsid() { Val = "00853401" };

            W.StyleParagraphProperties styleParagraphProperties7 = new W.StyleParagraphProperties();
            W.Indentation indentation2 = new W.Indentation() { Left = "420", LeftChars = 200 };

            styleParagraphProperties7.Append(indentation2);

            style15.Append(styleName15);
            style15.Append(basedOn11);
            style15.Append(nextParagraphStyle4);
            style15.Append(autoRedefine2);
            style15.Append(uIPriority14);
            style15.Append(unhideWhenUsed8);
            style15.Append(rsid11);
            style15.Append(styleParagraphProperties7);

            W.Style style16 = new W.Style() { Type = W.StyleValues.Character, StyleId = "a6" };
            W.StyleName styleName16 = new W.StyleName() { Val = "Hyperlink" };
            W.BasedOn basedOn12 = new W.BasedOn() { Val = "a0" };
            W.UIPriority uIPriority15 = new W.UIPriority() { Val = 99 };
            W.UnhideWhenUsed unhideWhenUsed9 = new W.UnhideWhenUsed();
            W.Rsid rsid12 = new W.Rsid() { Val = "00853401" };

            W.StyleRunProperties styleRunProperties9 = new W.StyleRunProperties();
            W.Color color1 = new W.Color() { Val = "0000FF", ThemeColor = W.ThemeColorValues.Hyperlink };
            W.Underline underline1 = new W.Underline() { Val = W.UnderlineValues.Single };

            styleRunProperties9.Append(color1);
            styleRunProperties9.Append(underline1);

            style16.Append(styleName16);
            style16.Append(basedOn12);
            style16.Append(uIPriority15);
            style16.Append(unhideWhenUsed9);
            style16.Append(rsid12);
            style16.Append(styleRunProperties9);

            styles1.Append(docDefaults1);
            styles1.Append(latentStyles1);
            styles1.Append(style1);
            styles1.Append(style2);
            styles1.Append(style3);
            styles1.Append(style4);
            styles1.Append(style5);
            styles1.Append(style6);
            styles1.Append(style7);
            styles1.Append(style8);
            styles1.Append(style9);
            styles1.Append(style10);
            styles1.Append(style11);
            styles1.Append(style12);
            styles1.Append(style13);
            styles1.Append(style14);
            styles1.Append(style15);
            styles1.Append(style16);

            styleDefinitionsPart.Styles = styles1;
        }

        public void save()
        {
            doc.Body = body;
            mainDoc.Document = doc;
            GenerateStyleDefinitionsPart1Content(mainDoc.AddNewPart<StyleDefinitionsPart>("rId1"));
            wDoc.Close();
        }

    }
}

 

 

 

 

 

 

 

关于标题和目录级别,在上面的代码中,只能生成2级标题,3级标题样式没有。3级标题要添加style,Val分别为heading3(为标题样式),val为标题3 char(标题样式),val为toc 3(目录域中的样式包括缩进)。

在这一部分的代码中还有一个问题没有解决,就是页码问题,因为在反编译的页码都是写好的,而我又不知道如何获得书签所在位置的页码,所以生成的页码是空的。因为项目中要打开所以最后用interop方式更新了页码。最近知道找到了相关的页码的更新问题,可以通过更新域,页码就会生成,word中也是如此做,对word不熟悉所以不知道。搜索openxml 更新域相关的内容就可以找到一些资料的

       最近由于忙着其他任务,没有时间更新openxml内容,特别这一篇,早在一个月前就开始写了,到现在才完成,自己太懒散了。定个目标,接下来一个月写两到三篇openxml生成一些特殊内容或者格式的文章,五月份以后不忙,一个星期写2到3篇关于openxml的文章,主要内容是翻译官网上的例子和相关的一些博客。

代码下载地址:https://files.cnblogs.com/weu135/OContents%E7%A4%BA%E4%BE%8B%E7%89%88.rar

posted @ 2013-03-31 12:02  上兵伐谋  阅读(3251)  评论(3编辑  收藏  举报