IBibliographyStylesProvider

public interface IBibliographyStylesProvider

Implement this interface to provide bibliography style for the 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");

     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");
     }
 }
 

Methods

MethodDescription
getStyle(String styleFileName)Returns bibliography style.

getStyle(String styleFileName)

public abstract InputStream getStyle(String styleFileName)

Returns bibliography style.

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");

     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");
     }
 }
 

Parameters:

ParameterTypeDescription
styleFileNamejava.lang.StringThe bibliography style file name.

Returns: java.io.InputStream - The java.io.InputStream with bibliography style XSLT stylesheet.