public class FieldAutoTextList extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Creates a shortcut menu based on AutoText entries in the active template.
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getEntryName()
Gets the name of the AutoText entry.
|
java.lang.String |
getListStyle()
Gets the name of the style on which the list to contain entries is based.
|
java.lang.String |
getScreenTip()
Gets the text of the ScreenTip to show.
|
int |
getSwitchType(java.lang.String switchName) |
void |
setEntryName(java.lang.String value)
Sets the name of the AutoText entry.
|
void |
setListStyle(java.lang.String value)
Sets the name of the style on which the list to contain entries is based.
|
void |
setScreenTip(java.lang.String value)
Sets the text of the ScreenTip to show.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getEntryName()
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
public void setEntryName(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
value - The name of the AutoText entry.java.lang.Exceptionpublic java.lang.String getListStyle()
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
public void setListStyle(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
value - The name of the style on which the list to contain entries is based.java.lang.Exceptionpublic java.lang.String getScreenTip()
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
public void setScreenTip(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use an AUTOTEXTLIST field to select from a list of AutoText entries.
public void fieldAutoTextList() throws Exception {
Document doc = new Document();
// Create a glossary document and populate it with auto text entries.
doc.setGlossaryDocument(new GlossaryDocument());
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 1", "Contents of AutoText 1");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 2", "Contents of AutoText 2");
appendAutoTextEntry(doc.getGlossaryDocument(), "AutoText 3", "Contents of AutoText 3");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an AUTOTEXTLIST field and set the text that the field will display in Microsoft Word.
// Set the text to prompt the user to right-click this field to select an AutoText building block,
// whose contents the field will display.
FieldAutoTextList field = (FieldAutoTextList) builder.insertField(FieldType.FIELD_AUTO_TEXT_LIST, true);
field.setEntryName("Right click here to select an AutoText block");
field.setListStyle("Heading 1");
field.setScreenTip("Hover tip text for AutoTextList goes here");
Assert.assertEquals(" AUTOTEXTLIST \"Right click here to select an AutoText block\" " +
"\\s \"Heading 1\" " +
"\\t \"Hover tip text for AutoTextList goes here\"", field.getFieldCode());
doc.save(getArtifactsDir() + "Field.AUTOTEXTLIST.dotx");
}
/// <summary>
/// Create an AutoText-type building block and add it to a glossary document.
/// </summary>
private static void appendAutoTextEntry(GlossaryDocument glossaryDoc, String name, String contents) {
BuildingBlock buildingBlock = new BuildingBlock(glossaryDoc);
buildingBlock.setName(name);
buildingBlock.setGallery(BuildingBlockGallery.AUTO_TEXT);
buildingBlock.setCategory("General");
buildingBlock.setBehavior(BuildingBlockBehavior.PARAGRAPH);
Section section = new Section(glossaryDoc);
section.appendChild(new Body(glossaryDoc));
section.getBody().appendParagraph(contents);
buildingBlock.appendChild(section);
glossaryDoc.appendChild(buildingBlock);
}
value - The text of the ScreenTip to show.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)