ImageOrPrintOptions

ImageOrPrintOptions class

Allows to specify options when rendering worksheet to images, printing worksheet or rendering chart to image.

class ImageOrPrintOptions;

Example

const { Workbook, ImageOrPrintOptions } = require("aspose.cells.node");

//Set Image Or Print Options
var options = new ImageOrPrintOptions();
//set Horizontal resolution
options.setHorizontalResolution(200);
//set Vertica; Resolution
options.setVerticalResolution(300);

//Instantiate Workbook
var book = new Workbook("input/Chart.xls");
//Save chart as Image using ImageOrPrint Options
book.getWorksheets().get(0).getCharts().get(0).toImage("output/chart.png", options);

Constructors

NameDescription
constructor()Default Constructor.

Methods

MethodDescription
setPrintWithStatusDialog(boolean)If PrintWithStatusDialog = true , there will be a dialog that shows current print status. else no such dialog will show.
getPrintWithStatusDialog()If PrintWithStatusDialog = true , there will be a dialog that shows current print status. else no such dialog will show.
getHorizontalResolution()Gets or sets the horizontal resolution for generated images, in dots per inch.
setHorizontalResolution(number)Gets or sets the horizontal resolution for generated images, in dots per inch.
getVerticalResolution()Gets or sets the vertical resolution for generated images, in dots per inch.
setVerticalResolution(number)Gets or sets the vertical resolution for generated images, in dots per inch.
getTiffCompression()Gets or sets the type of compression to apply only when saving pages to the Tiff format.
setTiffCompression(TiffCompression)Gets or sets the type of compression to apply only when saving pages to the Tiff format.
getTiffColorDepth()Gets or sets bit depth to apply only when saving pages to the Tiff format.
setTiffColorDepth(ColorDepth)Gets or sets bit depth to apply only when saving pages to the Tiff format.
getTiffBinarizationMethod()Gets or sets method used while converting images to 1 bpp format when ImageType is Tiff and TiffCompression is equal to Ccitt3 or Ccitt4.
setTiffBinarizationMethod(ImageBinarizationMethod)Gets or sets method used while converting images to 1 bpp format when ImageType is Tiff and TiffCompression is equal to Ccitt3 or Ccitt4.
getPrintingPage()Indicates which pages will not be printed.
setPrintingPage(PrintingPageType)Indicates which pages will not be printed.
getQuality()Gets or sets a value determining the quality of the generated images to apply only when saving pages to the Jpeg format. The default value is 100
setQuality(number)Gets or sets a value determining the quality of the generated images to apply only when saving pages to the Jpeg format. The default value is 100
getImageType()Gets or sets the format of the generated images. default value: PNG.
setImageType(ImageType)Gets or sets the format of the generated images. default value: PNG.
getOnePagePerSheet()If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.
setOnePagePerSheet(boolean)If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.
getAllColumnsInOnePagePerSheet()If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.
setAllColumnsInOnePagePerSheet(boolean)If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.
getDrawObjectEventHandler()Implements this interface to get DrawObject and Bound when rendering.
setDrawObjectEventHandler(DrawObjectEventHandler)Implements this interface to get DrawObject and Bound when rendering.
getEmbededImageNameInSvg()Indicate the filename of embedded image in svg. This should be full path with directory like “c:\xpsEmbedded”
setEmbededImageNameInSvg(string)Indicate the filename of embedded image in svg. This should be full path with directory like “c:\xpsEmbedded”
getSVGFitToViewPort()if this property is true, the generated svg will fit to view port.
setSVGFitToViewPort(boolean)if this property is true, the generated svg will fit to view port.
getOnlyArea()If this property is true , one Area will be output, and no scale will take effect.
setOnlyArea(boolean)If this property is true , one Area will be output, and no scale will take effect.
getTransparent()Indicates if the background of generated image should be transparent.
setTransparent(boolean)Indicates if the background of generated image should be transparent.
setWarningCallback(IWarningCallback)Gets or sets warning callback.
getWarningCallback()Gets or sets warning callback.
getPageSavingCallback()Control/Indicate progress of page saving process.
setPageSavingCallback(IPageSavingCallback)Control/Indicate progress of page saving process.
setIsFontSubstitutionCharGranularity(boolean)Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
isFontSubstitutionCharGranularity()Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
setPageIndex(number)Gets or sets the 0-based index of the first page to save.
getPageIndex()Gets or sets the 0-based index of the first page to save.
setPageCount(number)Gets or sets the number of pages to save.
getPageCount()Gets or sets the number of pages to save.
isOptimized()Indicates whether to optimize the output elements.
setIsOptimized(boolean)Indicates whether to optimize the output elements.
getDefaultFont()When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.
setDefaultFont(string)When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.
getCheckWorkbookDefaultFont()When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.
setCheckWorkbookDefaultFont(boolean)When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.
getOutputBlankPageWhenNothingToPrint()Indicates whether to output a blank page when there is nothing to print.
setOutputBlankPageWhenNothingToPrint(boolean)Indicates whether to output a blank page when there is nothing to print.
getGridlineType()Gets or sets gridline type.
setGridlineType(GridlineType)Gets or sets gridline type.
getTextCrossType()Gets or sets displaying text type when the text width is larger than cell width.
setTextCrossType(TextCrossType)Gets or sets displaying text type when the text width is larger than cell width.
getDefaultEditLanguage()Gets or sets default edit language.
setDefaultEditLanguage(DefaultEditLanguage)Gets or sets default edit language.
getSheetSet()Gets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.
setSheetSet(SheetSet)Gets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.
getEmfRenderSetting()Setting for rendering Emf metafile.
setEmfRenderSetting(EmfRenderSetting)Setting for rendering Emf metafile.
setDesiredSize(number, number, boolean)Sets desired width and height of image.
isNull()Checks whether the implementation object is null.

constructor()

Default Constructor.

constructor();

setPrintWithStatusDialog(boolean)

If PrintWithStatusDialog = true , there will be a dialog that shows current print status. else no such dialog will show.

setPrintWithStatusDialog(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getPrintWithStatusDialog()

If PrintWithStatusDialog = true , there will be a dialog that shows current print status. else no such dialog will show.

getPrintWithStatusDialog() : boolean;

getHorizontalResolution()

Gets or sets the horizontal resolution for generated images, in dots per inch.

getHorizontalResolution() : number;

Remarks

ara>The default value is 96. Setting HorizontalResolution and VerticalResolution effects the width and height of the output image in pixels.</para

setHorizontalResolution(number)

Gets or sets the horizontal resolution for generated images, in dots per inch.

setHorizontalResolution(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

ara>The default value is 96. Setting HorizontalResolution and VerticalResolution effects the width and height of the output image in pixels.</para

getVerticalResolution()

Gets or sets the vertical resolution for generated images, in dots per inch.

getVerticalResolution() : number;

Remarks

ara>The default value is 96. Setting HorizontalResolution and VerticalResolution effects the width and height of the output image in pixels.</para

setVerticalResolution(number)

Gets or sets the vertical resolution for generated images, in dots per inch.

setVerticalResolution(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

ara>The default value is 96. Setting HorizontalResolution and VerticalResolution effects the width and height of the output image in pixels.</para

getTiffCompression()

Gets or sets the type of compression to apply only when saving pages to the Tiff format.

getTiffCompression() : TiffCompression;

Returns

TiffCompression

Remarks

Has effect only when saving to TIFF. The default value is Lzw.

setTiffCompression(TiffCompression)

Gets or sets the type of compression to apply only when saving pages to the Tiff format.

setTiffCompression(value: TiffCompression) : void;

Parameters:

ParameterTypeDescription
valueTiffCompressionThe value to set.

Remarks

Has effect only when saving to TIFF. The default value is Lzw.

getTiffColorDepth()

Gets or sets bit depth to apply only when saving pages to the Tiff format.

getTiffColorDepth() : ColorDepth;

Returns

ColorDepth

Remarks

Has effect only when saving to TIFF. If TiffCompression is set to CCITT3, CCITT4, this will not take effect, the bit depth of the generated tiff image will be always 1.

setTiffColorDepth(ColorDepth)

Gets or sets bit depth to apply only when saving pages to the Tiff format.

setTiffColorDepth(value: ColorDepth) : void;

Parameters:

ParameterTypeDescription
valueColorDepthThe value to set.

Remarks

Has effect only when saving to TIFF. If TiffCompression is set to CCITT3, CCITT4, this will not take effect, the bit depth of the generated tiff image will be always 1.

getTiffBinarizationMethod()

Gets or sets method used while converting images to 1 bpp format when ImageType is Tiff and TiffCompression is equal to Ccitt3 or Ccitt4.

getTiffBinarizationMethod() : ImageBinarizationMethod;

Returns

ImageBinarizationMethod

Remarks

The default value is FloydSteinbergDithering.

setTiffBinarizationMethod(ImageBinarizationMethod)

Gets or sets method used while converting images to 1 bpp format when ImageType is Tiff and TiffCompression is equal to Ccitt3 or Ccitt4.

setTiffBinarizationMethod(value: ImageBinarizationMethod) : void;

Parameters:

ParameterTypeDescription
valueImageBinarizationMethodThe value to set.

Remarks

The default value is FloydSteinbergDithering.

getPrintingPage()

Indicates which pages will not be printed.

getPrintingPage() : PrintingPageType;

Returns

PrintingPageType

setPrintingPage(PrintingPageType)

Indicates which pages will not be printed.

setPrintingPage(value: PrintingPageType) : void;

Parameters:

ParameterTypeDescription
valuePrintingPageTypeThe value to set.

getQuality()

Gets or sets a value determining the quality of the generated images to apply only when saving pages to the Jpeg format. The default value is 100

getQuality() : number;

Remarks

Has effect only when saving to JPEG. The value must be between 0 and 100. The default value is 100.

setQuality(number)

Gets or sets a value determining the quality of the generated images to apply only when saving pages to the Jpeg format. The default value is 100

setQuality(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

Has effect only when saving to JPEG. The value must be between 0 and 100. The default value is 100.

getImageType()

Gets or sets the format of the generated images. default value: PNG.

getImageType() : ImageType;

Returns

ImageType

setImageType(ImageType)

Gets or sets the format of the generated images. default value: PNG.

setImageType(value: ImageType) : void;

Parameters:

ParameterTypeDescription
valueImageTypeThe value to set.

getOnePagePerSheet()

If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

getOnePagePerSheet() : boolean;

setOnePagePerSheet(boolean)

If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

setOnePagePerSheet(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllColumnsInOnePagePerSheet()

If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

getAllColumnsInOnePagePerSheet() : boolean;

setAllColumnsInOnePagePerSheet(boolean)

If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

setAllColumnsInOnePagePerSheet(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getDrawObjectEventHandler()

Implements this interface to get DrawObject and Bound when rendering.

getDrawObjectEventHandler() : DrawObjectEventHandler;

Returns

DrawObjectEventHandler

setDrawObjectEventHandler(DrawObjectEventHandler)

Implements this interface to get DrawObject and Bound when rendering.

setDrawObjectEventHandler(value: DrawObjectEventHandler) : void;

Parameters:

ParameterTypeDescription
valueDrawObjectEventHandlerThe value to set.

getEmbededImageNameInSvg()

Indicate the filename of embedded image in svg. This should be full path with directory like “c:\xpsEmbedded”

getEmbededImageNameInSvg() : string;

setEmbededImageNameInSvg(string)

Indicate the filename of embedded image in svg. This should be full path with directory like “c:\xpsEmbedded”

setEmbededImageNameInSvg(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getSVGFitToViewPort()

if this property is true, the generated svg will fit to view port.

getSVGFitToViewPort() : boolean;

setSVGFitToViewPort(boolean)

if this property is true, the generated svg will fit to view port.

setSVGFitToViewPort(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getOnlyArea()

If this property is true , one Area will be output, and no scale will take effect.

getOnlyArea() : boolean;

setOnlyArea(boolean)

If this property is true , one Area will be output, and no scale will take effect.

setOnlyArea(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getTransparent()

Indicates if the background of generated image should be transparent.

getTransparent() : boolean;

Remarks

The default value is false. That means the background of the generated images is white.

setTransparent(boolean)

Indicates if the background of generated image should be transparent.

setTransparent(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

The default value is false. That means the background of the generated images is white.

setWarningCallback(IWarningCallback)

Gets or sets warning callback.

setWarningCallback(value: IWarningCallback) : void;

Parameters:

ParameterTypeDescription
valueIWarningCallbackThe value to set.

getWarningCallback()

Gets or sets warning callback.

getWarningCallback() : IWarningCallback;

Returns

IWarningCallback

getPageSavingCallback()

Control/Indicate progress of page saving process.

getPageSavingCallback() : IPageSavingCallback;

Returns

IPageSavingCallback

setPageSavingCallback(IPageSavingCallback)

Control/Indicate progress of page saving process.

setPageSavingCallback(value: IPageSavingCallback) : void;

Parameters:

ParameterTypeDescription
valueIPageSavingCallbackThe value to set.

setIsFontSubstitutionCharGranularity(boolean)

Indicates whether to only substitute the font of character when the cell font is not compatibility for it.

setIsFontSubstitutionCharGranularity(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.

isFontSubstitutionCharGranularity()

Indicates whether to only substitute the font of character when the cell font is not compatibility for it.

isFontSubstitutionCharGranularity() : boolean;

Remarks

Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.

setPageIndex(number)

Gets or sets the 0-based index of the first page to save.

setPageIndex(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

Default is 0.

getPageIndex()

Gets or sets the 0-based index of the first page to save.

getPageIndex() : number;

Remarks

Default is 0.

setPageCount(number)

Gets or sets the number of pages to save.

setPageCount(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

Default is System.Int32.MaxValue which means all pages will be rendered.

getPageCount()

Gets or sets the number of pages to save.

getPageCount() : number;

Remarks

Default is System.Int32.MaxValue which means all pages will be rendered.

isOptimized()

Indicates whether to optimize the output elements.

isOptimized() : boolean;

Remarks

Default value is false. Currently when this property is set to true, the following optimizations will be done: 1. optimize the border lines. 2. optimize the file size while rendering to Svg image.

setIsOptimized(boolean)

Indicates whether to optimize the output elements.

setIsOptimized(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Default value is false. Currently when this property is set to true, the following optimizations will be done: 1. optimize the border lines. 2. optimize the file size while rendering to Svg image.

getDefaultFont()

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.

getDefaultFont() : string;

setDefaultFont(string)

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.

setDefaultFont(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getCheckWorkbookDefaultFont()

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.

getCheckWorkbookDefaultFont() : boolean;

Remarks

Default is true.

setCheckWorkbookDefaultFont(boolean)

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.

setCheckWorkbookDefaultFont(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Default is true.

getOutputBlankPageWhenNothingToPrint()

Indicates whether to output a blank page when there is nothing to print.

getOutputBlankPageWhenNothingToPrint() : boolean;

Remarks

Default is false.

setOutputBlankPageWhenNothingToPrint(boolean)

Indicates whether to output a blank page when there is nothing to print.

setOutputBlankPageWhenNothingToPrint(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Default is false.

getGridlineType()

Gets or sets gridline type.

getGridlineType() : GridlineType;

Returns

GridlineType

Remarks

Default is Dotted type.

setGridlineType(GridlineType)

Gets or sets gridline type.

setGridlineType(value: GridlineType) : void;

Parameters:

ParameterTypeDescription
valueGridlineTypeThe value to set.

Remarks

Default is Dotted type.

getTextCrossType()

Gets or sets displaying text type when the text width is larger than cell width.

getTextCrossType() : TextCrossType;

Returns

TextCrossType

setTextCrossType(TextCrossType)

Gets or sets displaying text type when the text width is larger than cell width.

setTextCrossType(value: TextCrossType) : void;

Parameters:

ParameterTypeDescription
valueTextCrossTypeThe value to set.

getDefaultEditLanguage()

Gets or sets default edit language.

getDefaultEditLanguage() : DefaultEditLanguage;

Returns

DefaultEditLanguage

Remarks

It may display/render different layouts for text paragraph when different edit languages is set. Default is Aspose.Cells.DefaultEditLanguage.Auto.

setDefaultEditLanguage(DefaultEditLanguage)

Gets or sets default edit language.

setDefaultEditLanguage(value: DefaultEditLanguage) : void;

Parameters:

ParameterTypeDescription
valueDefaultEditLanguageThe value to set.

Remarks

It may display/render different layouts for text paragraph when different edit languages is set. Default is Aspose.Cells.DefaultEditLanguage.Auto.

getSheetSet()

Gets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.

getSheetSet() : SheetSet;

Returns

SheetSet

Remarks

The set is ignored when it is used in SheetRender

setSheetSet(SheetSet)

Gets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.

setSheetSet(value: SheetSet) : void;

Parameters:

ParameterTypeDescription
valueSheetSetThe value to set.

Remarks

The set is ignored when it is used in SheetRender

getEmfRenderSetting()

Setting for rendering Emf metafile.

getEmfRenderSetting() : EmfRenderSetting;

Returns

EmfRenderSetting

Remarks

EMF metafiles identified as “EMF+ Dual” can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When Aspose.Cells.EmfRenderSetting.EmfPlusPrefer is set, then EMF+ records will be parsed while rendering to image, otherwise only EMF records will be parsed. Default value is Aspose.Cells.EmfRenderSetting.EmfOnly. For the frameworks that depend on .Net System.Drawing.Common, this setting is ignored.

setEmfRenderSetting(EmfRenderSetting)

Setting for rendering Emf metafile.

setEmfRenderSetting(value: EmfRenderSetting) : void;

Parameters:

ParameterTypeDescription
valueEmfRenderSettingThe value to set.

Remarks

EMF metafiles identified as “EMF+ Dual” can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When Aspose.Cells.EmfRenderSetting.EmfPlusPrefer is set, then EMF+ records will be parsed while rendering to image, otherwise only EMF records will be parsed. Default value is Aspose.Cells.EmfRenderSetting.EmfOnly. For the frameworks that depend on .Net System.Drawing.Common, this setting is ignored.

setDesiredSize(number, number, boolean)

Sets desired width and height of image.

setDesiredSize(desiredWidth: number, desiredHeight: number, keepAspectRatio: boolean) : void;

Parameters:

ParameterTypeDescription
desiredWidthnumberdesired width in pixels
desiredHeightnumberdesired height in pixels
keepAspectRatiobooleanwhether to keep aspect ratio of origin image

Remarks

ara>The width and height of the output image in pixels will be only based on the set desired width and height. The HorizontalResolution and VerticalResolution will not effect the width and height of the output image in this case.</para

isNull()

Checks whether the implementation object is null.

isNull() : boolean;