internal IStructureDocument method_21() { IStructureDocument entity = new StructureDocumentTag(base.m_doc); this.m_bodyItems.Add(entity); return(entity); }
private void button1_Click(object sender, EventArgs e) { //Load document from disk Document doc = new Document(); doc.LoadFromFile(@"..\..\..\..\..\..\Data\Template_Toc.docx"); //Defind a Toc style ParagraphStyle tocStyle = Style.CreateBuiltinStyle(BuiltinStyle.Toc1, doc) as ParagraphStyle; tocStyle.CharacterFormat.FontName = "Aleo"; tocStyle.CharacterFormat.FontSize = 15f; tocStyle.CharacterFormat.TextColor = Color.CadetBlue; doc.Styles.Add(tocStyle); //Loop through sections foreach (Section section in doc.Sections) { //Loop through content of section foreach (DocumentObject obj in section.Body.ChildObjects) { //Find the structure document tag if (obj is StructureDocumentTag) { StructureDocumentTag tag = obj as StructureDocumentTag; //Find the paragraph where the TOC1 locates foreach (DocumentObject cObj in tag.ChildObjects) { if (cObj is Paragraph) { Paragraph para = cObj as Paragraph; if (para.StyleName == "TOC1") { //Apply the new style for TOC1 paragraph para.ApplyStyle(tocStyle.Name); } } } } } } //Save the Word file string output = "ChangeTOCStyle_out.docx"; doc.SaveToFile(output, FileFormat.Docx2013); //Launch the file WordDocViewer(output); }
private void button1_Click(object sender, EventArgs e) { //Load document from disk Document doc = new Document(); doc.LoadFromFile(@"..\..\..\..\..\..\Data\Template_Toc.docx"); //Loop through sections foreach (Section section in doc.Sections) { //Loop through content of section foreach (DocumentObject obj in section.Body.ChildObjects) { //Find the structure document tag if (obj is StructureDocumentTag) { StructureDocumentTag tag = obj as StructureDocumentTag; //Find the paragraph where the TOC1 locates foreach (DocumentObject cObj in tag.ChildObjects) { if (cObj is Paragraph) { Paragraph para = cObj as Paragraph; if (para.StyleName == "TOC2") { //Set the tab style of paragraph foreach (Tab tab in para.Format.Tabs) { tab.Position = tab.Position + 20; tab.TabLeader = TabLeader.NoLeader; } } } } } } } //Save the Word file string output = "ChangeTOCTabStyle_out.docx"; doc.SaveToFile(output, FileFormat.Docx2013); //Launch the file WordDocViewer(output); }
private void button1_Click(object sender, EventArgs e) { //Load document from disk Document doc = new Document(); doc.LoadFromFile(@"..\..\..\..\..\..\Data\RemoveContentControls.docx"); //Loop through sections for (int s = 0; s < doc.Sections.Count; s++) { Section section = doc.Sections[s]; for (int i = 0; i < section.Body.ChildObjects.Count; i++) { //Loop through contents in paragraph if (section.Body.ChildObjects[i] is Paragraph) { Paragraph para = section.Body.ChildObjects[i] as Paragraph; for (int j = 0; j < para.ChildObjects.Count; j++) { //Find the StructureDocumentTagInline if (para.ChildObjects[j] is StructureDocumentTagInline) { StructureDocumentTagInline sdt = para.ChildObjects[j] as StructureDocumentTagInline; //Remove the content control from paragraph para.ChildObjects.Remove(sdt); j--; } } } if (section.Body.ChildObjects[i] is StructureDocumentTag) { StructureDocumentTag sdt = section.Body.ChildObjects[i] as StructureDocumentTag; section.Body.ChildObjects.Remove(sdt); i--; } } } //Save the Word document string output = "RemoveContentControls_out.docx"; doc.SaveToFile(output, FileFormat.Docx2013); //Launch the file WordDocViewer(output); }
public override VisitorAction vmethod_42(StructureDocumentTag A_0) { A_0.UpdateDataBinding(); return(VisitorAction.Continue); }
public virtual VisitorAction vmethod_43(StructureDocumentTag A_0) { return(VisitorAction.Continue); }