/// <summary> /// Initializes a new instance of the <see cref="TableOfContentsSource"/> class. /// </summary> /// <param name="tableOfContents">Content of the table of.</param> public TableOfContentsSource(TableOfContents tableOfContents) { TableOfContents = tableOfContents; TableOfContentsIndexTemplateCollection = new TableOfContentsIndexTemplateCollection(); Node = new XElement(Ns.Text + "table-of-content-source"); //the only supported table of content style, will be //based on the header and their outline levels, //but loading other styles should be possible, but won't //be modifiable. Node.SetAttributeValue(Ns.Text + "outline-level", "10"); //Create the index-title-template node //this is always the title of the TableOfContent //of the referenced TableOfContent oject XElement indexTitleTemplateNode = new XElement(Ns.Text + "index-title-template", TableOfContents.Title); //Fixed style for the title template indexTitleTemplateNode.SetAttributeValue(Ns.Text + "style-name", "Contents_20_Heading"); Node.Add(indexTitleTemplateNode); }
/// <summary> /// Initializes a new instance of the <see cref="TableOfContentsSource"/> class. /// </summary> /// <param name="tableOfContents">Content of the table of.</param> public TableOfContentsSource(TableOfContents tableOfContents) { this._tableOfContents = tableOfContents; this.TableOfContentsIndexTemplateCollection = new TableOfContentsIndexTemplateCollection(); this.NewXmlNode(); }