com.aspose.words
Class HtmlSaveOptions

java.lang.Object
  extended by SaveOptions
      extended by com.aspose.words.HtmlSaveOptions
All Implemented Interfaces:
java.lang.Cloneable

public class HtmlSaveOptions 
extends SaveOptions

Can be used to specify additional options when saving a document into the SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB format.

Example:

Shows how to set save options before saving a document to HTML.
Document doc = new Document(getMyDir() + "Rendering.doc");

// This is the directory we want the exported images to be saved to.
File imagesDir = new File(getMyDir(), "Images");

// The folder specified needs to exist and should be empty.
if(imagesDir.exists())
    imagesDir.delete();

imagesDir.mkdir();

// Set an option to export form fields as plain text, not as HTML input elements.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setExportTextInputFormFieldAsText(true);
options.setImagesFolder(imagesDir.getPath());

doc.save(getMyDir() + "Document.SaveWithOptions Out.html", options);

Example:

Shows how to define custom logic for controlling how images are saved when exporting to HTML based formats.
public void saveHtmlExportImages() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Create and pass the object which implements the handler methods.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
    options.setImageSavingCallback(new HandleImageSaving());

    doc.save(getMyDir() + "Document.SaveWithCustomImagesExport Out.html", options);
}

public class HandleImageSaving implements IImageSavingCallback
{
    public void imageSaving(ImageSavingArgs e) throws Exception
    {
        // Change any images in the document being exported with the extension of "jpeg" to "jpg".
        if (e.getImageFileName().endsWith(".jpeg"))
            e.setImageFileName(e.getImageFileName().replace(".jpeg", ".jpg"));
    }
}

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);

Constructor Summary
HtmlSaveOptions()
           Initializes a new instance of this class that can be used to save a document in the SaveFormat.HTML format.
HtmlSaveOptions(int saveFormat)
           Initializes a new instance of this class that can be used to save a document in the SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB format.
 
Property Getters/Setters Summary
booleangetAllowNegativeIndent()
voidsetAllowNegativeIndent(boolean value)
           Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.
booleangetAllowNegativeLeftIndent()
voidsetAllowNegativeLeftIndent(boolean value)
           Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.
intgetColorMode()→ inherited from SaveOptions
voidsetColorMode(int value)
           Gets or sets a value determining how colors are rendered. The value of the property is ColorMode integer constant.
ICssSavingCallbackgetCssSavingCallback()
voidsetCssSavingCallback(ICssSavingCallback value)
           Allows to control how CSS styles are saved when a document is saved to HTML, MHTML or EPUB.
java.lang.StringgetCssStyleSheetFileName()
voidsetCssStyleSheetFileName(java.lang.String value)
           Specifies the name of the Cascading Style Sheet (CSS) file written when the document is exported to HTML. Default is an empty string.
intgetCssStyleSheetType()
voidsetCssStyleSheetType(int value)
           Specifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is CssStyleSheetType.INLINE for HTML/MHTML and CssStyleSheetType.EXTERNAL for EPUB. The value of the property is CssStyleSheetType integer constant.
intgetDmlEffectsRenderingMode()→ inherited from SaveOptions
voidsetDmlEffectsRenderingMode(int value)
           Gets or sets a value determining how DrawingML effects are rendered. The value of the property is DmlEffectsRenderingMode integer constant.
intgetDmlRenderingMode()→ inherited from SaveOptions
voidsetDmlRenderingMode(int value)
           Gets or sets a value determining how DrawingML shapes are rendered. The value of the property is DmlRenderingMode integer constant.
IDocumentPartSavingCallbackgetDocumentPartSavingCallback()
voidsetDocumentPartSavingCallback(IDocumentPartSavingCallback value)
           Allows to control how document parts are saved when a document is saved to HTML or EPUB.
intgetDocumentSplitCriteria()
voidsetDocumentSplitCriteria(int value)
           Specifies how the document should be split when saving to SaveFormat.HTML or SaveFormat.EPUB format. Default is DocumentSplitCriteria.NONE for HTML and DocumentSplitCriteria.HEADING_PARAGRAPH for EPUB. The value of the property is DocumentSplitCriteria integer constant.
intgetDocumentSplitHeadingLevel()
voidsetDocumentSplitHeadingLevel(int value)
           Specifies the maximum level of headings at which to split the document. Default value is 2.
java.nio.charset.CharsetgetEncoding()
voidsetEncoding(java.nio.charset.Charset value)
           Specifies the encoding to use when exporting to HTML, MHTML or EPUB. Default value is 'UTF-8' Charset.
intgetEpubNavigationMapLevel()
voidsetEpubNavigationMapLevel(int value)
           Specifies the maximum level of headings populated to the navigation map when exporting to IDPF EPUB format. Default value is 3.
booleangetExportDocumentProperties()
voidsetExportDocumentProperties(boolean value)
           Specifies whether to export built-in and custom document properties to HTML, MHTML or EPUB. Default value is false.
booleangetExportDropDownFormFieldAsText()
voidsetExportDropDownFormFieldAsText(boolean value)
           Controls how drop-down form fields are saved to HTML or MHTML. Default value is false.
booleangetExportFontResources()
voidsetExportFontResources(boolean value)
           Specifies whether font resources should be exported to HTML, MHTML or EPUB. Default is false.
booleangetExportHeadersFooters()
voidsetExportHeadersFooters(boolean value)
           Specifies whether to output headers and footers to HTML, MHTML or EPUB. Default value is true for HTML/MHTML and false for EPUB.
intgetExportHeadersFootersMode()
voidsetExportHeadersFootersMode(int value)
           Specifies how headers and footers are output to HTML, MHTML or EPUB. Default value is ExportHeadersFootersMode.PER_SECTION for HTML/MHTML and ExportHeadersFootersMode.NONE for EPUB. The value of the property is ExportHeadersFootersMode integer constant.
booleangetExportImagesAsBase64()
voidsetExportImagesAsBase64(boolean value)
           Specifies whether images are saved in Base64 format to HTML, MHTML or EPUB. Default is false.
booleangetExportLanguageInformation()
voidsetExportLanguageInformation(boolean value)
           Specifies whether language information is exported to HTML, MHTML or EPUB. Default is false.
intgetExportListLabels()
voidsetExportListLabels(int value)
           Controls how list labels are output to HTML, MHTML or EPUB. Default value is ExportListLabels.AUTO. The value of the property is ExportListLabels integer constant.
booleangetExportMetafileAsRaster()
voidsetExportMetafileAsRaster(boolean value)
           Specifies whether to convert metafiles into raster images when exporting to HTML, MHTML or EPUB. Default value is true.
booleangetExportOriginalUrlForLinkedImages()
voidsetExportOriginalUrlForLinkedImages(boolean value)
           Specifies whether original URL should be used as the URL of the linked images. Default value is false.
booleangetExportPageSetup()
voidsetExportPageSetup(boolean value)
           Specifies whether page setup is exported to HTML, MHTML or EPUB. Default is false.
booleangetExportRelativeFontSize()
voidsetExportRelativeFontSize(boolean value)
           Specifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false.
booleangetExportRoundtripInformation()
voidsetExportRoundtripInformation(boolean value)
           Specifies whether to write the roundtrip information when saving to HTML, MHTML or EPUB. Default value is true for HTML and false for MHTML and EPUB.
booleangetExportTextInputFormFieldAsText()
voidsetExportTextInputFormFieldAsText(boolean value)
           Controls how text input form fields are saved to HTML or MHTML. Default value is false.
booleangetExportTocPageNumbers()
voidsetExportTocPageNumbers(boolean value)
           Specifies whether to write page numbers to table of contents when saving HTML, MHTML and EPUB. Default value is false.
booleangetExportXhtmlTransitional()
voidsetExportXhtmlTransitional(boolean value)
           Specifies whether to write the DOCTYPE declaration when saving to HTML or MHTML. When true, writes a DOCTYPE declaration in the document prior to the root element. Default value is false. When saving to EPUB the DOCTYPE declaration is always written.
intgetFontResourcesSubsettingSizeThreshold()
voidsetFontResourcesSubsettingSizeThreshold(int value)
           Controls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0.
IFontSavingCallbackgetFontSavingCallback()
voidsetFontSavingCallback(IFontSavingCallback value)
           Allows to control how fonts are saved when a document is saved to HTML, MHTML or EPUB.
java.lang.StringgetFontsFolder()
voidsetFontsFolder(java.lang.String value)
           Specifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string.
java.lang.StringgetFontsFolderAlias()
voidsetFontsFolderAlias(java.lang.String value)
           Specifies the name of the folder used to construct font URIs written into an HTML document. Default is an empty string.
intgetImageResolution()
voidsetImageResolution(int value)
           Specifies the output resolution for images when exporting to HTML, MHTML or EPUB. Default is 96 dpi.
IImageSavingCallbackgetImageSavingCallback()
voidsetImageSavingCallback(IImageSavingCallback value)
           Allows to control how images are saved when a document is saved to HTML, MHTML or EPUB.
java.lang.StringgetImagesFolder()
voidsetImagesFolder(java.lang.String value)
           Specifies the physical folder where images are saved when exporting a document to HTML format. Default is an empty string.
java.lang.StringgetImagesFolderAlias()
voidsetImagesFolderAlias(java.lang.String value)
           Specifies the name of the folder used to construct image URIs written into an HTML document. Default is an empty string.
booleangetPrettyFormat()→ inherited from SaveOptions
voidsetPrettyFormat(boolean value)
           When true, pretty formats output where applicable. Default value is false.
intgetSaveFormat()
voidsetSaveFormat(int value)
           Specifies the format in which the document will be saved if this save options object is used. Can be SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB. The value of the property is SaveFormat integer constant.
booleangetScaleImageToShapeSize()
voidsetScaleImageToShapeSize(boolean value)
           Specifies whether images are scaled by Aspose.Words to the bounding shape size when exporting to HTML, MHTML or EPUB. Default value is true.
intgetTableWidthOutputMode()
voidsetTableWidthOutputMode(int value)
           Controls how table, row and cell widths are exported to HTML, MHTML or EPUB. Default value is HtmlElementSizeOutputMode.ALL. The value of the property is HtmlElementSizeOutputMode integer constant.
java.lang.StringgetTempFolder()→ inherited from SaveOptions
voidsetTempFolder(java.lang.String value)
           Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used.
booleangetUpdateSdtContent()→ inherited from SaveOptions
voidsetUpdateSdtContent(boolean value)
           Gets or sets value determining whether content of StructuredDocumentTag is updated before saving.
booleangetUseAntiAliasing()→ inherited from SaveOptions
voidsetUseAntiAliasing(boolean value)
           Gets or sets a value determining whether or not to use anti-aliasing for rendering.
booleangetUseHighQualityRendering()→ inherited from SaveOptions
voidsetUseHighQualityRendering(boolean value)
           Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.
IWarningCallbackgetWarningCallback()→ inherited from SaveOptions
voidsetWarningCallback(IWarningCallback value)
           Called during a save operation, when an issue is detected that might result in data or formatting fidelity loss.
 

Constructor Detail

HtmlSaveOptions

public HtmlSaveOptions()
Initializes a new instance of this class that can be used to save a document in the SaveFormat.HTML format.

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);

HtmlSaveOptions

public HtmlSaveOptions(int saveFormat)
Initializes a new instance of this class that can be used to save a document in the SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB format.
Parameters:
saveFormat - A SaveFormat value. Can be SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB.

Property Getters/Setters Detail

getAllowNegativeIndent/setAllowNegativeIndent

public boolean getAllowNegativeIndent() / public void setAllowNegativeIndent(boolean value)
Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.

When negative indent is not allowed, it is exported as zero margin to HTML. When negative indent is allowed, a paragraph might appear partially outside of the browser window.


getAllowNegativeLeftIndent/setAllowNegativeLeftIndent

public boolean getAllowNegativeLeftIndent() / public void setAllowNegativeLeftIndent(boolean value)
Specifies whether negative left and right indents of paragraphs are normalized when saving to HTML, MHTML or EPUB. Default value is false.

When negative indent is not allowed, it is exported as zero margin to HTML. When negative indent is allowed, a paragraph might appear partially outside of the browser window.


getColorMode/setColorMode

→ inherited from SaveOptions
public int getColorMode() / public void setColorMode(int value)
Gets or sets a value determining how colors are rendered. The value of the property is ColorMode integer constant.The default value is ColorMode.NORMAL

This property is used when the document is exported to fixed page formats.


getCssSavingCallback/setCssSavingCallback

public ICssSavingCallback getCssSavingCallback() / public void setCssSavingCallback(ICssSavingCallback value)
Allows to control how CSS styles are saved when a document is saved to HTML, MHTML or EPUB.

getCssStyleSheetFileName/setCssStyleSheetFileName

public java.lang.String getCssStyleSheetFileName() / public void setCssStyleSheetFileName(java.lang.String value)
Specifies the name of the Cascading Style Sheet (CSS) file written when the document is exported to HTML. Default is an empty string.

This property has effect only when saving a document to HTML format and external CSS style sheet is requested using CssStyleSheetType.

If you don't specify a value for this property, then the style sheet file will have the same name as the HTML document name, but with a ".css" extension.

See Also:
CssStyleSheetType

getCssStyleSheetType/setCssStyleSheetType

public int getCssStyleSheetType() / public void setCssStyleSheetType(int value)
Specifies how CSS (Cascading Style Sheet) styles are exported to HTML, MHTML or EPUB. Default value is CssStyleSheetType.INLINE for HTML/MHTML and CssStyleSheetType.EXTERNAL for EPUB. The value of the property is CssStyleSheetType integer constant.

Saving CSS style sheet into an external file is only supported when saving to HTML. When you are exporting to one of the container formats (EPUB or MHTML) and specifying CssStyleSheetType.EXTERNAL, CSS file will be encapsulated into the output package.

See Also:
CssStyleSheetFileName

getDmlEffectsRenderingMode/setDmlEffectsRenderingMode

→ inherited from SaveOptions
public int getDmlEffectsRenderingMode() / public void setDmlEffectsRenderingMode(int value)
Gets or sets a value determining how DrawingML effects are rendered. The value of the property is DmlEffectsRenderingMode integer constant. The default value is DmlEffectsRenderingMode.SIMPLIFIED.

This property is used when the document is exported to fixed page formats.


getDmlRenderingMode/setDmlRenderingMode

→ inherited from SaveOptions
public int getDmlRenderingMode() / public void setDmlRenderingMode(int value)
Gets or sets a value determining how DrawingML shapes are rendered. The value of the property is DmlRenderingMode integer constant. The default value is DmlRenderingMode.FALLBACK.

This property is used when the document is exported to fixed page formats.


getDocumentPartSavingCallback/setDocumentPartSavingCallback

public IDocumentPartSavingCallback getDocumentPartSavingCallback() / public void setDocumentPartSavingCallback(IDocumentPartSavingCallback value)
Allows to control how document parts are saved when a document is saved to HTML or EPUB.

getDocumentSplitCriteria/setDocumentSplitCriteria

public int getDocumentSplitCriteria() / public void setDocumentSplitCriteria(int value)
Specifies how the document should be split when saving to SaveFormat.HTML or SaveFormat.EPUB format. Default is DocumentSplitCriteria.NONE for HTML and DocumentSplitCriteria.HEADING_PARAGRAPH for EPUB. The value of the property is DocumentSplitCriteria integer constant.

Normally you would want a document saved to HTML as a single file. But in some cases it is preferable to split the output into several smaller HTML pages. When saving to HTML format these pages will be output to individual files or streams. When saving to EPUB format they will be incorporated into corresponding packages.

A document cannot be split when saving in the MHTML format.

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);
See Also:
DocumentSplitHeadingLevel, DocumentPartSavingCallback

getDocumentSplitHeadingLevel/setDocumentSplitHeadingLevel

public int getDocumentSplitHeadingLevel() / public void setDocumentSplitHeadingLevel(int value)
Specifies the maximum level of headings at which to split the document. Default value is 2.

When DocumentSplitCriteria includes DocumentSplitCriteria.HEADING_PARAGRAPH and this property is set to a value from 1 to 9, the document will be split at paragraphs formatted using Heading 1, Heading 2 , Heading 3 etc. styles up to the specified heading level.

By default, only Heading 1 and Heading 2 paragraphs cause the document to be split. Setting this property to zero will cause the document not to be split at heading paragraphs at all.

See Also:
DocumentSplitCriteria, DocumentPartSavingCallback

getEncoding/setEncoding

public java.nio.charset.Charset getEncoding() / public void setEncoding(java.nio.charset.Charset value)
Specifies the encoding to use when exporting to HTML, MHTML or EPUB. Default value is 'UTF-8' Charset.

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);

getEpubNavigationMapLevel/setEpubNavigationMapLevel

public int getEpubNavigationMapLevel() / public void setEpubNavigationMapLevel(int value)
Specifies the maximum level of headings populated to the navigation map when exporting to IDPF EPUB format. Default value is 3.

Navigation map in IDPF EPUB format allows user agents to provide easy way of navigation through the document structure. Usually navigation points correspond to headings in the document. To populate headings up to level N assign this value to EpubNavigationMapLevel.

By default, three levels of headings are populated: paragraphs of styles Heading 1, Heading 2 and Heading 3. You can set this property to a value from 1 to 9 to request corresponding maximum level. Setting it to zero will reduce navigation map to only document root or roots of document parts.


getExportDocumentProperties/setExportDocumentProperties

public boolean getExportDocumentProperties() / public void setExportDocumentProperties(boolean value)
Specifies whether to export built-in and custom document properties to HTML, MHTML or EPUB. Default value is false.

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);

getExportDropDownFormFieldAsText/setExportDropDownFormFieldAsText

public boolean getExportDropDownFormFieldAsText() / public void setExportDropDownFormFieldAsText(boolean value)
Controls how drop-down form fields are saved to HTML or MHTML. Default value is false.

When set to true, exports drop-down form fields as normal text. When false, exports drop-down form fields as SELECT element in HTML.

When exporting to EPUB, text drop-down form fields are always saved as text due to requirements of this format.


getExportFontResources/setExportFontResources

public boolean getExportFontResources() / public void setExportFontResources(boolean value)
Specifies whether font resources should be exported to HTML, MHTML or EPUB. Default is false.

Exporting font resources allows for consistent document rendering independent of the fonts available in a given user's environment.

If ExportFontResources is set to true, main HTML document will refer to every font via the CSS 3 @font-face at-rule and fonts will be output as separate files. When exporting to IDPF EPUB or MHTML formats, fonts will be embedded into the corresponding package along with other subsidiary files.

Important! When exporting font resources, font licensing issues should be considered. Authors who want to use specific fonts via a downloadable font mechanism must always carefully verify that their intended use is within the scope of the font license. Many commercial fonts presently do not allow web downloading of their fonts in any form. License agreements that cover some fonts specifically note that usage via @font-face rules in CSS style sheets is not allowed. Font subsetting can also violate license terms.

Example:

Shows how to define custom logic for handling font exporting when saving to HTML based formats.
public void saveHtmlExportFonts() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Set the option to export font resources.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.MHTML);
    options.setExportFontResources(true);
    // Create and pass the object which implements the handler methods.
    options.setFontSavingCallback(new HandleFontSaving());

    doc.save(getMyDir() + "Document.SaveWithFontsExport Out.html", options);
}

public class HandleFontSaving implements IFontSavingCallback
{
    public void fontSaving(FontSavingArgs args) throws Exception
    {
        // You can implement logic here to rename fonts, save to file etc. For this example just print some details about the current font being handled.
        System.out.println(MessageFormat.format("Font Name = {0}, Font Filename = {1}", args.getFontFamilyName(), args.getFontFileName()));
    }
}
See Also:
FontResourcesSubsettingSizeThreshold

getExportHeadersFooters/setExportHeadersFooters

public boolean getExportHeadersFooters() / public void setExportHeadersFooters(boolean value)
Specifies whether to output headers and footers to HTML, MHTML or EPUB. Default value is true for HTML/MHTML and false for EPUB.

This property is obsolete. Please use ExportHeadersFootersMode instead.


getExportHeadersFootersMode/setExportHeadersFootersMode

public int getExportHeadersFootersMode() / public void setExportHeadersFootersMode(int value)
Specifies how headers and footers are output to HTML, MHTML or EPUB. Default value is ExportHeadersFootersMode.PER_SECTION for HTML/MHTML and ExportHeadersFootersMode.NONE for EPUB. The value of the property is ExportHeadersFootersMode integer constant.

It is hard to meaningfully output headers and footers to HTML because HTML is not paginated. When this property is ExportHeadersFootersMode.PER_SECTION, Aspose.Words exports only primary headers and footers at the beginning and the end of each section. When it is ExportHeadersFootersMode.FIRST_SECTION_HEADER_LAST_SECTION_FOOTER only first primary header and the last primary footer (including linked to previous) are exported. You can disable export of headers and footers altogether by setting this property to ExportHeadersFootersMode.NONE.

Example:

Demonstrates how to disable the export of headers and footers when saving to HTML based formats.
Document doc = new Document(getMyDir() + "HeaderFooter.RemoveFooters.doc");

HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setExportHeadersFootersMode(ExportHeadersFootersMode.NONE); // Disables exporting headers and footers.

doc.save(getMyDir() + "HeaderFooter.DisableHeadersFooters Out.html", saveOptions);

getExportImagesAsBase64/setExportImagesAsBase64

public boolean getExportImagesAsBase64() / public void setExportImagesAsBase64(boolean value)
Specifies whether images are saved in Base64 format to HTML, MHTML or EPUB. Default is false.

When this property is set to true image data is exported directly on the img elements and separate files are not created.


getExportLanguageInformation/setExportLanguageInformation

public boolean getExportLanguageInformation() / public void setExportLanguageInformation(boolean value)
Specifies whether language information is exported to HTML, MHTML or EPUB. Default is false.

When this property is set to true Aspose.Words outputs lang HTML attribute on the document elements that specify language. This can be needed to preserve language related semantics.


getExportListLabels/setExportListLabels

public int getExportListLabels() / public void setExportListLabels(int value)
Controls how list labels are output to HTML, MHTML or EPUB. Default value is ExportListLabels.AUTO. The value of the property is ExportListLabels integer constant.

getExportMetafileAsRaster/setExportMetafileAsRaster

public boolean getExportMetafileAsRaster() / public void setExportMetafileAsRaster(boolean value)
Specifies whether to convert metafiles into raster images when exporting to HTML, MHTML or EPUB. Default value is true.

Metafiles are not natively displayed by HTML browsers. By default, Aspose.Words converts WMF and EMF images into PNG files when exporting to HTML. Setting this property to false causes metafiles to be exported to HTML without conversion.

Some image transforms, in particular image cropping, will not be applied to metafile images if this property is false.

See Also:
ImageResolution, ScaleImageToShapeSize

getExportOriginalUrlForLinkedImages/setExportOriginalUrlForLinkedImages

public boolean getExportOriginalUrlForLinkedImages() / public void setExportOriginalUrlForLinkedImages(boolean value)
Specifies whether original URL should be used as the URL of the linked images. Default value is false.

If value is set to trueImageData.SourceFullName value is used as the URL of linked images and linked images are not loaded into document's folder or ImagesFolder.

If value is set to false linked images are loaded into document's folder or ImagesFolder and URL of each linked image is constructed depending on document's folder, ImagesFolder and ImagesFolderAlias properties.


getExportPageSetup/setExportPageSetup

public boolean getExportPageSetup() / public void setExportPageSetup(boolean value)
Specifies whether page setup is exported to HTML, MHTML or EPUB. Default is false.

Each Section in Aspose.Words document model provides page setup information via PageSetup class. When you export a document to HTML format you might need to keep this information for further usage. In particular, page setup might be important for rendering to paged media (printing) or subsequent conversion to the native Microsoft Word file formats (DOCX, DOC, RTF, WML).

In most cases HTML is intended for viewing in browsers where pagination is not performed. So this feature is inactive by default.


getExportRelativeFontSize/setExportRelativeFontSize

public boolean getExportRelativeFontSize() / public void setExportRelativeFontSize(boolean value)
Specifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false.

In many existing documents (HTML, IDPF EPUB) font sizes are specified in relative units. This allows applications to adjust text size when viewing/processing documents. For instance, Microsoft Internet Explorer has "View->Text Size" submenu, Adobe Digital Editions has two buttons: Increase/Decrease Text Size. If you expect this functionality to work then set ExportRelativeFontSize property to true.

Aspose Words document model contains and operates only with absolute font size units. Relative units need additional logic to be recalculated from some initial (standard) size. Font size of Normal document style is taken as standard. For instance, if Normal has 12pt font and some text is 18pt then it will be output as 1.5em. to the HTML.

When this option is enabled, document elements other than text will still have absolute sizes. Also some text-related attributes might be expressed absolutely. In particular, line spacing specified with "exactly" rule might produce unwanted results when scaling text. So the source documents should be properly designed and tested when exporting with ExportRelativeFontSize set to true.


getExportRoundtripInformation/setExportRoundtripInformation

public boolean getExportRoundtripInformation() / public void setExportRoundtripInformation(boolean value)
Specifies whether to write the roundtrip information when saving to HTML, MHTML or EPUB. Default value is true for HTML and false for MHTML and EPUB.

Saving of the roundtrip information allows to restore document properties such as tab stops, comments, headers and footers during the HTML documents loading back into a Document object.

When true, the roundtrip information is exported as -aw-* CSS properties of the corresponding HTML elements.

When false, causes no roundtrip information to be output into produced files.


getExportTextInputFormFieldAsText/setExportTextInputFormFieldAsText

public boolean getExportTextInputFormFieldAsText() / public void setExportTextInputFormFieldAsText(boolean value)
Controls how text input form fields are saved to HTML or MHTML. Default value is false.

When set to true, exports text input form fields as normal text. When false, exports Word text input form fields as INPUT elements in HTML.

When exporting to EPUB, text input form fields are always saved as text due to requirements of this format.

Example:

Shows how to set save options before saving a document to HTML.
Document doc = new Document(getMyDir() + "Rendering.doc");

// This is the directory we want the exported images to be saved to.
File imagesDir = new File(getMyDir(), "Images");

// The folder specified needs to exist and should be empty.
if(imagesDir.exists())
    imagesDir.delete();

imagesDir.mkdir();

// Set an option to export form fields as plain text, not as HTML input elements.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setExportTextInputFormFieldAsText(true);
options.setImagesFolder(imagesDir.getPath());

doc.save(getMyDir() + "Document.SaveWithOptions Out.html", options);

getExportTocPageNumbers/setExportTocPageNumbers

public boolean getExportTocPageNumbers() / public void setExportTocPageNumbers(boolean value)
Specifies whether to write page numbers to table of contents when saving HTML, MHTML and EPUB. Default value is false.

getExportXhtmlTransitional/setExportXhtmlTransitional

public boolean getExportXhtmlTransitional() / public void setExportXhtmlTransitional(boolean value)
Specifies whether to write the DOCTYPE declaration when saving to HTML or MHTML. When true, writes a DOCTYPE declaration in the document prior to the root element. Default value is false. When saving to EPUB the DOCTYPE declaration is always written.

Aspose.Words always writes well formed HTML regardless of this setting.

When true, the beginning of the HTML output document will look like this:

            <?xml version="1.0" encoding="utf-8" standalone="no" ?>
            <!DOCTYPE html 
                  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
            

Aspose.Words aims to output XHTML according to the XHTML 1.0 Transitional specification, but the output will not always validate against the DTD. Some structures inside a Microsoft Word document are hard or impossible to map to a document that will validate against the XHTML schema. For example, XHTML does not allow nested lists (UL cannot be nested inside another UL element), but in Microsoft Word document multilevel lists occur quite often.


getFontResourcesSubsettingSizeThreshold/setFontResourcesSubsettingSizeThreshold

public int getFontResourcesSubsettingSizeThreshold() / public void setFontResourcesSubsettingSizeThreshold(int value)
Controls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0.

ExportFontResources allows exporting fonts as subsidiary files or as parts of the output package. If the document uses many fonts, especially with large number of glyphs, then output size can grow significantly. Font subsetting reduces the size of the exported font resource by filtering out glyphs that are not used by the current document.

Font subsetting works as follows:

  • By default, all exported fonts are subsetted.
  • Setting FontResourcesSubsettingSizeThreshold to a positive value instructs Aspose.Words to subset fonts which file size is larger than the specified value.
  • Setting the property to java.lang.Integer.MAX_VALUE suppresses font subsetting.

Important! When exporting font resources, font licensing issues should be considered. Authors who want to use specific fonts via a downloadable font mechanism must always carefully verify that their intended use is within the scope of the font license. Many commercial fonts presently do not allow web downloading of their fonts in any form. License agreements that cover some fonts specifically note that usage via @font-face rules in CSS style sheets is not allowed. Font subsetting can also violate license terms.

See Also:
ExportFontResources

getFontSavingCallback/setFontSavingCallback

public IFontSavingCallback getFontSavingCallback() / public void setFontSavingCallback(IFontSavingCallback value)
Allows to control how fonts are saved when a document is saved to HTML, MHTML or EPUB.

Example:

Shows how to define custom logic for handling font exporting when saving to HTML based formats.
public void saveHtmlExportFonts() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Set the option to export font resources.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.MHTML);
    options.setExportFontResources(true);
    // Create and pass the object which implements the handler methods.
    options.setFontSavingCallback(new HandleFontSaving());

    doc.save(getMyDir() + "Document.SaveWithFontsExport Out.html", options);
}

public class HandleFontSaving implements IFontSavingCallback
{
    public void fontSaving(FontSavingArgs args) throws Exception
    {
        // You can implement logic here to rename fonts, save to file etc. For this example just print some details about the current font being handled.
        System.out.println(MessageFormat.format("Font Name = {0}, Font Filename = {1}", args.getFontFamilyName(), args.getFontFileName()));
    }
}

getFontsFolder/setFontsFolder

public java.lang.String getFontsFolder() / public void setFontsFolder(java.lang.String value)
Specifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string.

When you save a Document in HTML format and ExportFontResources is set to true, Aspose.Words needs to save fonts used in the document as standalone files. FontsFolder allows you to specify where the fonts will be saved and FontsFolderAlias allows to specify how the font URIs will be constructed.

If you save a document into a file and provide a file name, Aspose.Words, by default, saves the fonts in the same folder where the document file is saved. Use FontsFolder to override this behavior.

If you save a document into a stream, Aspose.Words does not have a folder where to save the fonts, but still needs to save the fonts somewhere. In this case, you need to specify an accessible folder in the FontsFolder property or provide custom streams via the FontSavingCallback event handler.

See Also:
ExportFontResources, FontsFolderAlias, FontSavingCallback

getFontsFolderAlias/setFontsFolderAlias

public java.lang.String getFontsFolderAlias() / public void setFontsFolderAlias(java.lang.String value)
Specifies the name of the folder used to construct font URIs written into an HTML document. Default is an empty string.

When you save a Document in HTML format and ExportFontResources is set to true, Aspose.Words needs to save fonts used in the document as standalone files. FontsFolder allows you to specify where the fonts will be saved and FontsFolderAlias allows to specify how the font URIs will be constructed.

If FontsFolderAlias is not an empty string, then the font URI written to HTML will be FontsFolderAlias + <font file name>.

If FontsFolderAlias is an empty string, then the font URI written to HTML will be FontsFolder + <font file name>.

If FontsFolderAlias is set to '.' (dot), then the font file name will be written to HTML without path regardless of other options.

See Also:
ExportFontResources, FontsFolder, FontSavingCallback

getImageResolution/setImageResolution

public int getImageResolution() / public void setImageResolution(int value)
Specifies the output resolution for images when exporting to HTML, MHTML or EPUB. Default is 96 dpi.

This property effects raster images when ScaleImageToShapeSize is true and effects metafiles when ExportMetafileAsRaster is true. Some image properties such as cropping or rotation require saving transformed images and in this case transformed images are created in the given resolution.

See Also:
ScaleImageToShapeSize

getImageSavingCallback/setImageSavingCallback

public IImageSavingCallback getImageSavingCallback() / public void setImageSavingCallback(IImageSavingCallback value)
Allows to control how images are saved when a document is saved to HTML, MHTML or EPUB.

Example:

Shows how to define custom logic for controlling how images are saved when exporting to HTML based formats.
public void saveHtmlExportImages() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Create and pass the object which implements the handler methods.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
    options.setImageSavingCallback(new HandleImageSaving());

    doc.save(getMyDir() + "Document.SaveWithCustomImagesExport Out.html", options);
}

public class HandleImageSaving implements IImageSavingCallback
{
    public void imageSaving(ImageSavingArgs e) throws Exception
    {
        // Change any images in the document being exported with the extension of "jpeg" to "jpg".
        if (e.getImageFileName().endsWith(".jpeg"))
            e.setImageFileName(e.getImageFileName().replace(".jpeg", ".jpg"));
    }
}

getImagesFolder/setImagesFolder

public java.lang.String getImagesFolder() / public void setImagesFolder(java.lang.String value)
Specifies the physical folder where images are saved when exporting a document to HTML format. Default is an empty string.

When you save a Document in HTML format, Aspose.Words needs to save all images embedded in the document as standalone files. ImagesFolder allows you to specify where the images will be saved and ImagesFolderAlias allows to specify how the image URIs will be constructed.

If you save a document into a file and provide a file name, Aspose.Words, by default, saves the images in the same folder where the document file is saved. Use ImagesFolder to override this behavior.

If you save a document into a stream, Aspose.Words does not have a folder where to save the images, but still needs to save the images somewhere. In this case, you need to specify an accessible folder in the ImagesFolder property or provide custom streams via the ImageSavingCallback event handler.

Example:

Shows how to set save options before saving a document to HTML.
Document doc = new Document(getMyDir() + "Rendering.doc");

// This is the directory we want the exported images to be saved to.
File imagesDir = new File(getMyDir(), "Images");

// The folder specified needs to exist and should be empty.
if(imagesDir.exists())
    imagesDir.delete();

imagesDir.mkdir();

// Set an option to export form fields as plain text, not as HTML input elements.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML);
options.setExportTextInputFormFieldAsText(true);
options.setImagesFolder(imagesDir.getPath());

doc.save(getMyDir() + "Document.SaveWithOptions Out.html", options);
See Also:
ImagesFolderAlias, ImageSavingCallback

getImagesFolderAlias/setImagesFolderAlias

public java.lang.String getImagesFolderAlias() / public void setImagesFolderAlias(java.lang.String value)
Specifies the name of the folder used to construct image URIs written into an HTML document. Default is an empty string.

When you save a Document in HTML format, Aspose.Words needs to save all images embedded in the document as standalone files. ImagesFolder allows you to specify where the images will be saved and ImagesFolderAlias allows to specify how the image URIs will be constructed.

If ImagesFolderAlias is not an empty string, then the image URI written to HTML will be ImagesFolderAlias + <image file name>.

If ImagesFolderAlias is an empty string, then the image URI written to HTML will be ImagesFolder + <image file name>.

If ImagesFolderAlias is set to '.' (dot), then the image file name will be written to HTML without path regardless of other options.

See Also:
ImagesFolder, ImageSavingCallback

getPrettyFormat/setPrettyFormat

→ inherited from SaveOptions
public boolean getPrettyFormat() / public void setPrettyFormat(boolean value)
When true, pretty formats output where applicable. Default value is false.

Set to true to make HTML, MHTML, EPUB, WordML, RTF, DOCX and ODT output human readable. Useful for testing or debugging.

Example:

Shows how to pass an option to export HTML tags in a well spaced, human readable format.
Document doc = new Document(getMyDir() + "Document.doc");

HtmlSaveOptions htmlOptions = new HtmlSaveOptions(SaveFormat.HTML);
// Enabling the PrettyFormat setting will export HTML in an indented format that is easy to read.
// If this is setting is false (by default) then the HTML tags will be exported in condensed form with no indentation.
htmlOptions.setPrettyFormat(true);

doc.save(getMyDir() + "Document.PrettyFormat Out.html", htmlOptions);

getSaveFormat/setSaveFormat

public int getSaveFormat() / public void setSaveFormat(int value)
Specifies the format in which the document will be saved if this save options object is used. Can be SaveFormat.HTML, SaveFormat.MHTML or SaveFormat.EPUB. The value of the property is SaveFormat integer constant.

Example:

Converts a document to EPUB with save options specified.
// Open an existing document from disk.
Document doc = new Document(getMyDir() + "Document.EpubConversion.doc");

// Create a new instance of HtmlSaveOptions. This object allows us to set options that control
// how the output document is saved.
HtmlSaveOptions saveOptions =
        new HtmlSaveOptions();

// Specify the desired encoding.
saveOptions.setEncoding(Charset.forName("UTF-8"));

// Specify at what elements to split the internal HTML at. This creates a new HTML within the EPUB
// which allows you to limit the size of each HTML part. This is useful for readers which cannot read
// HTML files greater than a certain size e.g 300kb.
saveOptions.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);

// Specify that we want to export document properties.
saveOptions.setExportDocumentProperties(true);

// Specify that we want to save in EPUB format.
saveOptions.setSaveFormat(SaveFormat.EPUB);

// Export the document as an EPUB file.
doc.save(getMyDir() + "Document.EpubConversion Out.epub", saveOptions);

getScaleImageToShapeSize/setScaleImageToShapeSize

public boolean getScaleImageToShapeSize() / public void setScaleImageToShapeSize(boolean value)
Specifies whether images are scaled by Aspose.Words to the bounding shape size when exporting to HTML, MHTML or EPUB. Default value is true.

An image in a Microsoft Word document is a shape. The shape has a size and the image has its own size. The sizes are not directly linked. For example, the image can be 1024x786 pixels, but shape that displays this image can be 400x300 points.

In order to display an image in the browser, it must be scaled to the shape size. The ScaleImageToShapeSize property controls where the scaling of the image takes place: in Aspose.Words during export to HTML or in the browser when displaying the document.

When ScaleImageToShapeSize is true, the image is scaled by Aspose.Words using high quality scaling during export to HTML. When ScaleImageToShapeSize is false, the image is output with its original size and the browser has to scale it.

In general, browsers do quick and poor quality scaling. As a result, you will normally get better display quality in the browser and smaller file size when ScaleImageToShapeSize is true, but better printing quality and faster conversion when ScaleImageToShapeSize is false.

See Also:
ImageResolution

getTableWidthOutputMode/setTableWidthOutputMode

public int getTableWidthOutputMode() / public void setTableWidthOutputMode(int value)
Controls how table, row and cell widths are exported to HTML, MHTML or EPUB. Default value is HtmlElementSizeOutputMode.ALL. The value of the property is HtmlElementSizeOutputMode integer constant.

In the HTML format, table, row and cell elements (<table>, <tr>, <th>, <td>) can have their widths specified either in relative (percentage) or in absolute units. In a document in Aspose.Words, tables, rows and cells can have their widths specified using either relative or absolute units too.

When you convert a document to HTML using Aspose.Words, you might want to control how table, row and cell widths are exported to affect how the resulting document is displayed in the visual agent (e.g. a browser or viewer).

Use this property as a filter to specify what table widths values are exported into the destination document. For example, if you are converting a document to EPUB and intend to view the document on a mobile reading device, then you probably want to avoid exporting absolute width values. To do this you need to specify the output mode HtmlElementSizeOutputMode.RELATIVE_ONLY or HtmlElementSizeOutputMode.NONE so the viewer on the mobile device can layout the table to fit the width of the screen as best as it can.


getTempFolder/setTempFolder

→ inherited from SaveOptions
public java.lang.String getTempFolder() / public void setTempFolder(java.lang.String value)
Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used.

When Aspose.Words saves a document, it needs to create temporary internal structures. By default, these internal structures are created in memory and the memory usage spikes for a short period while the document is being saved. When saving is complete, the memory is freed and reclaimed by the garbage collector.

If you are saving a very large document (thousands of pages) and/or processing many documents at the same time, then the memory spike during saving can be significant enough to cause the system to throw System.OutOfMemoryException. Specifying a temporary folder using TempFolder will cause Aspose.Words to keep the internal structures in temporary files instead of memory. It reduces the memory usage during saving, but will decrease the save performance.

The folder must exist and be writable, otherwise an exception will be thrown.

Aspose.Words automatically deletes all temporary files when saving is complete.


getUpdateSdtContent/setUpdateSdtContent

→ inherited from SaveOptions
public boolean getUpdateSdtContent() / public void setUpdateSdtContent(boolean value)
Gets or sets value determining whether content of StructuredDocumentTag is updated before saving. The default value is true.

getUseAntiAliasing/setUseAntiAliasing

→ inherited from SaveOptions
public boolean getUseAntiAliasing() / public void setUseAntiAliasing(boolean value)
Gets or sets a value determining whether or not to use anti-aliasing for rendering.

The default value is false. When this value is set to true anti-aliasing is used for rendering.

This property is used when the document is exported to the following formats: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG. When the document is exported to the SaveFormat.HTML, SaveFormat.MHTML and SaveFormat.EPUB formats this option is used for raster images.


getUseHighQualityRendering/setUseHighQualityRendering

→ inherited from SaveOptions
public boolean getUseHighQualityRendering() / public void setUseHighQualityRendering(boolean value)
Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. The default value is false.

This property is used when the document is exported to image formats: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG.


getWarningCallback/setWarningCallback

→ inherited from SaveOptions
public IWarningCallback getWarningCallback() / public void setWarningCallback(IWarningCallback value)
Called during a save operation, when an issue is detected that might result in data or formatting fidelity loss.

This property is obsolete. Please use DocumentBase.WarningCallback instead.

Example:

Demonstrates how to implement the IWarningCallback to be notified of any font substitution during document save.
public class HandleDocumentWarnings implements IWarningCallback
{
    /**
     * Our callback only needs to implement the "Warning" method. This method is called whenever there is a
     * potential issue during document procssing. The callback can be set to listen for warnings generated during document
     * load and/or document save.
     */
    public void warning(WarningInfo info)
    {
        // We are only interested in fonts being substituted.
        if (info.getWarningType() == WarningType.FONT_SUBSTITUTION)
        {
            System.out.println("Font substitution: " + info.getDescription());
        }
    }

}

Example:

Demonstrates how to recieve notifications of font substitutions by using IWarningCallback.
// Load the document to render.
Document doc = new Document(getMyDir() + "Document.doc");

// We can choose the default font to use in the case of any missing fonts.
FontSettings.setDefaultFontName("Arial");

// For testing we will set Aspose.Words to look for fonts only in a folder which doesn't exist. Since Aspose.Words won't
// find any fonts in the specified directory, then during rendering the fonts in the document will be subsuited with the default
// font specified under FontSettings.DefaultFontName. We can pick up on this subsuition using our callback.
FontSettings.setFontsFolder("", false);

// Create a new class implementing IWarningCallback which collect any warnings produced during document save.
HandleDocumentWarnings callback = new HandleDocumentWarnings();

// We assign the callback to the appropriate save options class. In this case, we are going to save to PDF
// so we create a PdfSaveOptions class and assign the callback there.
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setWarningCallback(callback);

// Pass the save options along with the save path to the save method.
doc.save(getMyDir() + "Rendering.MissingFontNotification Out.pdf", saveOptions);

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.