com.aspose.words
Class ToaCategories

java.lang.Object
    extended by com.aspose.words.ToaCategories

public class ToaCategories 
extends java.lang.Object

Represents a table of authorities categories.

Example:

Shows how to specify a table of authorities categories for a document.
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.getFieldOptions().setToaCategories(toaCategories);

toaCategories.set(1, "My Category 1"); // Replaces default value "Cases"
toaCategories.set(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.assertEquals("Cases", ToaCategories.getDefaultCategories().get(1));
Assert.assertEquals("Statutes", ToaCategories.getDefaultCategories().get(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.PAGE_BREAK);

// Insert table of authorities entries across 2 categories
builder.insertField("TA \\c 2 \\l \"entry 1\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 1 \\l \"entry 2\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 2 \\l \"entry 3\"");

doc.updateFields();
doc.save(getArtifactsDir() + "FieldOptions.TOA.Categories.docx");

Constructor Summary
ToaCategories()
          
 
Property Getters/Setters Summary
static ToaCategoriesgetDefaultCategories()
           Gets the default table of authorities categories.
java.lang.Stringget(int number)
voidset(int number, java.lang.String value)
           Gets or sets the category heading by category number.
 

Constructor Detail

ToaCategories

public ToaCategories()

Property Getters/Setters Detail

getDefaultCategories

public static ToaCategories getDefaultCategories()
Gets the default table of authorities categories. Use the FieldOptions.ToaCategories property to specify table of authorities categories for a single document.

Example:

Shows how to specify a table of authorities categories for a document.
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.getFieldOptions().setToaCategories(toaCategories);

toaCategories.set(1, "My Category 1"); // Replaces default value "Cases"
toaCategories.set(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.assertEquals("Cases", ToaCategories.getDefaultCategories().get(1));
Assert.assertEquals("Statutes", ToaCategories.getDefaultCategories().get(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.PAGE_BREAK);

// Insert table of authorities entries across 2 categories
builder.insertField("TA \\c 2 \\l \"entry 1\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 1 \\l \"entry 2\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 2 \\l \"entry 3\"");

doc.updateFields();
doc.save(getArtifactsDir() + "FieldOptions.TOA.Categories.docx");

get/set

public java.lang.String get(int number) / public void set(int number, java.lang.String value)
Gets or sets the category heading by category number.

Example:

Shows how to specify a table of authorities categories for a document.
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.getFieldOptions().setToaCategories(toaCategories);

toaCategories.set(1, "My Category 1"); // Replaces default value "Cases"
toaCategories.set(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.assertEquals("Cases", ToaCategories.getDefaultCategories().get(1));
Assert.assertEquals("Statutes", ToaCategories.getDefaultCategories().get(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.PAGE_BREAK);

// Insert table of authorities entries across 2 categories
builder.insertField("TA \\c 2 \\l \"entry 1\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 1 \\l \"entry 2\"");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.insertField("TA \\c 2 \\l \"entry 3\"");

doc.updateFields();
doc.save(getArtifactsDir() + "FieldOptions.TOA.Categories.docx");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.