GetStyle

IBibliographyStylesProvider.GetStyle method

Returns bibliography style.

public Stream GetStyle(string styleFileName)
ParameterTypeDescription
styleFileNameStringThe bibliography style file name.

Return Value

The Stream with bibliography style XSLT stylesheet.

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()
{
    Document doc = new Document(MyDir + "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.FieldOptions.BibliographyStylesProvider = new BibliographyStylesProvider();
    doc.UpdateFields();

    doc.Save(ArtifactsDir + "Field.ChangeBibliographyStyles.docx");

}

public class BibliographyStylesProvider : IBibliographyStylesProvider
{
    Stream IBibliographyStylesProvider.GetStyle(string styleFileName)
    {
        return File.OpenRead(MyDir + "Bibliography custom style.xsl");
    }
}

See Also