public class FieldBibliography extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Inserts the contents of the document's Bibliography part in a bibliographic style.
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFilterLanguageId()
Gets the language ID that is used to filter the bibliographic data to only the sources in the document that use that language.
|
java.lang.String |
getFormatLanguageId()
Gets the language ID that is used to format the bibliographic sources in the document.
|
java.lang.String |
getSourceTag()
Gets a value so that only the sources with matching Tag element value are displayed in the bibliography.
|
int |
getSwitchType(java.lang.String switchName) |
void |
setFilterLanguageId(java.lang.String value)
Sets the language ID that is used to filter the bibliographic data to only the sources in the document that use that language.
|
void |
setFormatLanguageId(java.lang.String value)
Sets the language ID that is used to format the bibliographic sources in the document.
|
void |
setSourceTag(java.lang.String value)
Sets a value so that only the sources with matching Tag element value are displayed in the bibliography.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getFormatLanguageId()
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
public void setFormatLanguageId(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
value - The language ID that is used to format the bibliographic sources in the document.java.lang.Exceptionpublic java.lang.String getFilterLanguageId()
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
public void setFilterLanguageId(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
value - The language ID that is used to filter the bibliographic data to only the sources in the document that use that language.java.lang.Exceptionpublic java.lang.String getSourceTag()
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
public void setSourceTag(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to work with CITATION and BIBLIOGRAPHY fields.
// Open a document containing bibliographical sources that we can find in
// Microsoft Word via References -> Citations & Bibliography -> Manage Sources.
Document doc = new Document(getMyDir() + "Bibliography.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Text to be cited with one source.");
// Create a citation with just the page number and the author of the referenced book.
FieldCitation fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
// We refer to sources using their tag names.
fieldCitation.setSourceTag("Book1");
fieldCitation.setPageNumber("85");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(true);
fieldCitation.setSuppressYear(true);
Assert.assertEquals(" CITATION Book1 \\p 85 \\t \\y", fieldCitation.getFieldCode());
// Create a more detailed citation which cites two sources.
builder.insertParagraph();
builder.write("Text to be cited with two sources.");
fieldCitation = (FieldCitation) builder.insertField(FieldType.FIELD_CITATION, true);
fieldCitation.setSourceTag("Book1");
fieldCitation.setAnotherSourceTag("Book2");
fieldCitation.setFormatLanguageId("en-US");
fieldCitation.setPageNumber("19");
fieldCitation.setPrefix("Prefix ");
fieldCitation.setSuffix(" Suffix");
fieldCitation.setSuppressAuthor(false);
fieldCitation.setSuppressTitle(false);
fieldCitation.setSuppressYear(false);
fieldCitation.setVolumeNumber("VII");
Assert.assertEquals(" CITATION Book1 \\m Book2 \\l en-US \\p 19 \\f \"Prefix \" \\s \" Suffix\" \\v VII", fieldCitation.getFieldCode());
// We can use a BIBLIOGRAPHY field to display all the sources within the document.
builder.insertBreak(BreakType.PAGE_BREAK);
FieldBibliography fieldBibliography = (FieldBibliography)builder.insertField(FieldType.FIELD_BIBLIOGRAPHY, true);
fieldBibliography.setFormatLanguageId("5129");
fieldBibliography.setFilterLanguageId("5129");
fieldBibliography.setSourceTag("Book2");
Assert.assertEquals(" BIBLIOGRAPHY \\l 5129 \\f 5129 \\m Book2", fieldBibliography.getFieldCode());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.CITATION.docx");
value - A value so that only the sources with matching Tag element value are displayed in the bibliography.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)