FieldOptionsToaCategories Property |
Namespace: Aspose.Words.Fields
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // There are default category values we can use, or we can make our own like this ToaCategories toaCategories = new ToaCategories(); doc.FieldOptions.ToaCategories = toaCategories; toaCategories[1] = "My Category 1"; // Replaces default value "Cases" toaCategories[2] = "My Category 2"; // Replaces default value "Statutes" // Even if we changed the categories in the FieldOptions object, the default categories are still available here Assert.AreEqual("Cases", ToaCategories.DefaultCategories[1]); Assert.AreEqual("Statutes", ToaCategories.DefaultCategories[2]); // Insert 2 tables of authorities, one per category builder.InsertField("TOA \\c 1 \\h", null); builder.InsertField("TOA \\c 2 \\h", null); builder.InsertBreak(BreakType.PageBreak); // Insert table of authorities entries across 2 categories builder.InsertField("TA \\c 2 \\l \"entry 1\""); builder.InsertBreak(BreakType.PageBreak); builder.InsertField("TA \\c 1 \\l \"entry 2\""); builder.InsertBreak(BreakType.PageBreak); builder.InsertField("TA \\c 2 \\l \"entry 3\""); doc.UpdateFields(); doc.Save(ArtifactsDir + "Field.TOA.Categories.docx");