本文整理汇总了C#中Aspose.Words.Document.UpdateFields方法的典型用法代码示例。如果您正苦于以下问题:C# Document.UpdateFields方法的具体用法?C# Document.UpdateFields怎么用?C# Document.UpdateFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aspose.Words.Document
的用法示例。
在下文中一共展示了Document.UpdateFields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateTOC
public void UpdateTOC()
{
Aspose.Words.Document doc = new Aspose.Words.Document();
//ExStart
//ExId:UpdateTOC
//ExSummary:Shows how to completely rebuild TOC fields in the document by invoking field update.
doc.UpdateFields();
//ExEnd
}
示例2: UpdateFields
public void UpdateFields()
{
//ExStart
//ExFor:Document.UpdateFields
//ExId:UpdateFieldsInDocument
//ExSummary:Shows how to update all fields in a document.
Aspose.Words.Document doc = new Aspose.Words.Document(MyDir + "Document.doc");
doc.UpdateFields();
//ExEnd
}
示例3: InsertToc
public void InsertToc()
{
//ExStart
//ExFor:DocumentBuilder.InsertTableOfContents
//ExFor:Document.UpdateFields
//ExFor:DocumentBuilder.#ctor(Document)
//ExFor:ParagraphFormat.StyleIdentifier
//ExFor:DocumentBuilder.InsertBreak
//ExFor:BreakType
//ExId:InsertTableOfContents
//ExSummary:Demonstrates how to insert a Table of contents (TOC) into a document using heading styles as entries.
// Use a blank document
Aspose.Words.Document doc = new Aspose.Words.Document();
// Create a document builder to insert content with into document.
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a table of contents at the beginning of the document.
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
// Start the actual document content on the second page.
builder.InsertBreak(BreakType.PageBreak);
// Build a document with complex structure by applying different heading styles thus creating TOC entries.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("Heading 1");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("Heading 2");
builder.Writeln("Heading 3");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 3.1");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;
builder.Writeln("Heading 3.1.1");
builder.Writeln("Heading 3.1.2");
builder.Writeln("Heading 3.1.3");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 3.2");
builder.Writeln("Heading 3.3");
// Call the method below to update the TOC.
doc.UpdateFields();
//ExEnd
doc.Save(ExDir + "DocumentBuilder.InsertToc Out.docx");
}
示例4: DocumentBuilderInsertTOC
public void DocumentBuilderInsertTOC()
{
//ExStart
//ExId:DocumentBuilderInsertTOC
//ExSummary:Shows how to insert a Table of Contents field into a document.
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a table of contents at the beginning of the document.
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
// The newly inserted table of contents will be initially empty.
// It needs to be populated by updating the fields in the document.
doc.UpdateFields();
//ExEnd
}
示例5: UpdateFieldsBeforeRendering
public void UpdateFieldsBeforeRendering()
{
//ExStart
//ExFor:Document.UpdateFields
//ExId:UpdateFieldsBeforeRendering
//ExSummary:Shows how to update all fields before rendering a document.
Aspose.Words.Document doc = new Aspose.Words.Document(ExDir + "Rendering.doc");
// This updates all fields in the document.
doc.UpdateFields();
doc.Save(ExDir + "Rendering.UpdateFields Out.pdf");
//ExEnd
}