public interface IBibliographyStylesProvider
FieldBibliography and FieldCitation fields when they're updated.
Examples:
Shows how to override built-in styles or provide custom one.
public void changeBibliographyStyles() throws Exception
{
Document doc = new Document(getMyDir() + "Bibliography.docx");
// If the document already has a style you can change it with the following code:
// doc.Bibliography.BibliographyStyle = "Bibliography custom style.xsl";
doc.getFieldOptions().setBibliographyStylesProvider(new BibliographyStylesProvider());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.ChangeBibliographyStyles.docx");
}
public static class BibliographyStylesProvider implements IBibliographyStylesProvider
{
public FileInputStream getStyle(String styleFileName) throws Exception
{
return new FileInputStream(getMyDir() + "Bibliography custom style.xsl");
}
}
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
getStyle(java.lang.String styleFileName)
Returns bibliography style.
|
java.io.InputStream getStyle(java.lang.String styleFileName)
throws java.lang.Exception
Remarks:
The implementation should return null to indicate that the MS Word version of specified style should be used.
Examples:
Shows how to override built-in styles or provide custom one.
public void changeBibliographyStyles() throws Exception
{
Document doc = new Document(getMyDir() + "Bibliography.docx");
// If the document already has a style you can change it with the following code:
// doc.Bibliography.BibliographyStyle = "Bibliography custom style.xsl";
doc.getFieldOptions().setBibliographyStylesProvider(new BibliographyStylesProvider());
doc.updateFields();
doc.save(getArtifactsDir() + "Field.ChangeBibliographyStyles.docx");
}
public static class BibliographyStylesProvider implements IBibliographyStylesProvider
{
public FileInputStream getStyle(String styleFileName) throws Exception
{
return new FileInputStream(getMyDir() + "Bibliography custom style.xsl");
}
}
styleFileName - The bibliography style file name.InputStream with bibliography style XSLT stylesheet.java.lang.Exception