public class ImageOrPrintOptions
extends java.lang.Object
Example
//Set Image Or Print Options
ImageOrPrintOptions options = new ImageOrPrintOptions();
//Set output image format
options.setImageType(ImageType.PNG);
//Set Horizontal resolution
options.setHorizontalResolution(300);
//Set Vertical Resolution
options.setVerticalResolution(300);
//Instantiate Workbook
Workbook book = new Workbook("test.xls");
//Save chart as Image using ImageOrPrint Options
book.getWorksheets().get(0).getCharts().get(0).toImage("chart.png", options);
| Constructor and Description |
|---|
ImageOrPrintOptions()
Ctor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getAllColumnsInOnePagePerSheet()
If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result.
|
ImageFormat |
getChartImageType()
Deprecated.
Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality.
|
boolean |
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.
|
CustomRenderSettings |
getCustomRenderSettings()
Gets custom settings during rendering.
|
int |
getDefaultEditLanguage()
Gets default edit language.
|
java.lang.String |
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.
|
DrawObjectEventHandler |
getDrawObjectEventHandler()
Implements this interface to get DrawObject and Bound when rendering.
|
java.lang.String |
getEmbededImageNameInSvg()
Deprecated.
Images are now always embedded in Svg with base64 format, please remove this property.
|
int |
getEmfRenderSetting()
Setting for rendering Emf metafiles in source file.
|
Color |
getGridlineColor()
Gets gridline colr.
|
int |
getGridlineType()
Gets gridline type.
|
int |
getHorizontalResolution()
Gets the horizontal resolution for generated images, in dots per inch.
|
int |
getImageType()
Gets the format of the generated images.
|
boolean |
getOnePagePerSheet()
If OnePagePerSheet is true , all content of one sheet will output to only one page in result.
|
boolean |
getOnlyArea()
If this property is true , one Area will be output, and no scale will take effect.
|
boolean |
getOutputBlankPageWhenNothingToPrint()
Indicates whether to output a blank page when there is nothing to print.
|
int |
getPageCount()
Gets the number of pages to save.
|
int |
getPageIndex()
Gets the 0-based index of the first page to save.
|
IPageSavingCallback |
getPageSavingCallback()
Control/Indicate progress of page saving process.
|
int |
getPrintingPage()
Indicates which pages will not be printed.
|
boolean |
getPrintWithStatusDialog()
If PrintWithStatusDialog = true , there will be a dialog that shows current print status.
|
int |
getQuality()
Gets a value determining the quality of the generated images
to apply only when saving pages to the
Jpeg format. |
int |
getSaveFormat()
Deprecated.
For Tiff/Svg, use ImageType; For Xps, use Workbook.Save(string, SaveOptions) with XpsSaveOptions
|
SheetSet |
getSheetSet()
Gets the sheets to render.
|
java.lang.String |
getSvgCssPrefix()
Deprecated.
Use SvgImageOptions.CssPrefix property instead.
|
boolean |
getSVGFitToViewPort()
Deprecated.
Use SvgImageOptions.FitToViewPort property instead.
|
int |
getTextCrossType()
Gets displaying text type when the text width is larger than cell width.
|
int |
getTiffColorDepth()
Gets bit depth to apply only when saving pages to the
Tiff format. |
int |
getTiffCompression()
Gets the type of compression to apply only when saving pages to the
Tiff format. |
int |
getTiffPhotometricInterpretation()
Gets the type of PhotometricInterpretation to apply only when saving pages to the
Tiff format. |
boolean |
getTransparent()
Indicates if the background of generated image should be transparent.
|
int |
getVerticalResolution()
Gets the vertical resolution for generated images, in dots per inch.
|
IWarningCallback |
getWarningCallback()
Gets warning callback.
|
boolean |
isCellAutoFit()
Deprecated.
This property is not used, please remove this property.
|
boolean |
isFontSubstitutionCharGranularity()
Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
|
boolean |
isOptimized()
Indicates whether to optimize the output elements.
|
void |
setAllColumnsInOnePagePerSheet(boolean value)
If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result.
|
void |
setCellAutoFit(boolean value)
Deprecated.
This property is not used, please remove this property.
|
void |
setChartImageType(ImageFormat value)
Deprecated.
Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality.
|
void |
setCheckWorkbookDefaultFont(boolean value)
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.
|
void |
setCustomRenderSettings(CustomRenderSettings value)
Sets custom settings during rendering.
|
void |
setDefaultEditLanguage(int value)
Sets default edit language.
|
void |
setDefaultFont(java.lang.String value)
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.
|
void |
setDesiredSize(int desiredWidth,
int desiredHeight)
Deprecated.
Use SetDesiredSize(int, int, bool) by setting param keepAspectRatio to false instead.
|
void |
setDesiredSize(int desiredWidth,
int desiredHeight,
boolean keepAspectRatio)
Sets desired width and height of image.
|
void |
setDrawObjectEventHandler(DrawObjectEventHandler value)
Implements this interface to get DrawObject and Bound when rendering.
|
void |
setEmbededImageNameInSvg(java.lang.String value)
Deprecated.
Images are now always embedded in Svg with base64 format, please remove this property.
|
void |
setEmfRenderSetting(int value)
Setting for rendering Emf metafiles in source file.
|
void |
setFontSubstitutionCharGranularity(boolean value)
Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
|
void |
setGridlineColor(Color value)
Sets gridline colr.
|
void |
setGridlineType(int value)
Sets gridline type.
|
void |
setHorizontalResolution(int value)
Sets the horizontal resolution for generated images, in dots per inch.
|
void |
setImageType(int value)
Sets the format of the generated images.
|
void |
setOnePagePerSheet(boolean value)
If OnePagePerSheet is true , all content of one sheet will output to only one page in result.
|
void |
setOnlyArea(boolean value)
If this property is true , one Area will be output, and no scale will take effect.
|
void |
setOptimized(boolean value)
Indicates whether to optimize the output elements.
|
void |
setOutputBlankPageWhenNothingToPrint(boolean value)
Indicates whether to output a blank page when there is nothing to print.
|
void |
setPageCount(int value)
Sets the number of pages to save.
|
void |
setPageIndex(int value)
Sets the 0-based index of the first page to save.
|
void |
setPageSavingCallback(IPageSavingCallback value)
Control/Indicate progress of page saving process.
|
void |
setPrintingPage(int value)
Indicates which pages will not be printed.
|
void |
setPrintWithStatusDialog(boolean value)
If PrintWithStatusDialog = true , there will be a dialog that shows current print status.
|
void |
setQuality(int value)
Sets a value determining the quality of the generated images
to apply only when saving pages to the
Jpeg format. |
void |
setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object value)
Sets the value of a single preference for the rendering algorithms.
|
void |
setSaveFormat(int value)
Deprecated.
For Tiff/Svg, use ImageType; For Xps, use Workbook.Save(string, SaveOptions) with XpsSaveOptions
|
void |
setSheetSet(SheetSet value)
Sets the sheets to render.
|
void |
setSvgCssPrefix(java.lang.String value)
Deprecated.
Use SvgImageOptions.CssPrefix property instead.
|
void |
setSVGFitToViewPort(boolean value)
Deprecated.
Use SvgImageOptions.FitToViewPort property instead.
|
void |
setTextCrossType(int value)
Sets displaying text type when the text width is larger than cell width.
|
void |
setTiffColorDepth(int value)
Sets bit depth to apply only when saving pages to the
Tiff format. |
void |
setTiffCompression(int value)
Sets the type of compression to apply only when saving pages to the
Tiff format. |
void |
setTiffPhotometricInterpretation(int value)
Sets the type of PhotometricInterpretation to apply only when saving pages to the
Tiff format. |
void |
setTransparent(boolean value)
Indicates if the background of generated image should be transparent.
|
void |
setVerticalResolution(int value)
Sets the vertical resolution for generated images, in dots per inch.
|
void |
setWarningCallback(IWarningCallback value)
Sets warning callback.
|
public int getSaveFormat()
See SaveFormat.
Remarks
NOTE: This member is now obsolete. Instead, For Tiff/Svg, useImageType; For Xps, use Workbook.save(String,SaveOptions) with XpsSaveOptions.
This property will be removed 12 months later since August 2022.
Aspose apologizes for any inconvenience you may have experienced.public void setSaveFormat(int value)
See SaveFormat.
Remarks
NOTE: This member is now obsolete. Instead, For Tiff/Svg, useImageType; For Xps, use Workbook.save(String,SaveOptions) with XpsSaveOptions.
This property will be removed 12 months later since August 2022.
Aspose apologizes for any inconvenience you may have experienced.public boolean getPrintWithStatusDialog()
public void setPrintWithStatusDialog(boolean value)
public int getHorizontalResolution()
Remarks
Example
The following code sets resolution to 192, the width and height of the generated image is twice of the one with resolution left as the default value 96.
Workbook wb = new Workbook("Book1.xlsx");
ImageOrPrintOptions opts = new ImageOrPrintOptions();
//Set output image type: png.
opts.setImageType(ImageType.PNG);
//Set resolution to 192.
opts.setHorizontalResolution(192);
opts.setVerticalResolution(192);
//Render worksheet page to image.
SheetRender sr = new SheetRender(wb.getWorksheets().get(0), opts);
sr.toImage(0, "Sheet_Page1.png");
public void setHorizontalResolution(int value)
Remarks
public int getVerticalResolution()
Remarks
Example
The following code sets resolution to 192, the width and height of the generated image is twice of the one with resolution left as the default value 96.
Workbook wb = new Workbook("Book1.xlsx");
ImageOrPrintOptions opts = new ImageOrPrintOptions();
//Set output image type: png.
opts.setImageType(ImageType.PNG);
//Set resolution to 192.
opts.setHorizontalResolution(192);
opts.setVerticalResolution(192);
//Render Chart to image.
wb.getWorksheets().get(0).getCharts().get(0).toImage("Chart.png", opts);
public void setVerticalResolution(int value)
Remarks
public int getTiffCompression()
Tiff format.
See TiffCompression.
Remarks
Has effect only when saving to TIFF. The default value is Lzw.public void setTiffCompression(int value)
Tiff format.
See TiffCompression.
Remarks
Has effect only when saving to TIFF. The default value is Lzw.public int getTiffColorDepth()
Tiff format.
See 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.public void setTiffColorDepth(int value)
Tiff format.
See 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.public int getTiffPhotometricInterpretation()
Tiff format.
Remarks
Has effect only when saving to TIFF. The default value is -1, represent no PhotometricInterpretation is applied.public void setTiffPhotometricInterpretation(int value)
Tiff format.
Remarks
Has effect only when saving to TIFF. The default value is -1, represent no PhotometricInterpretation is applied.public int getPrintingPage()
See PrintingPageType.
public void setPrintingPage(int value)
See PrintingPageType.
public int getQuality()
Jpeg format. The default value is 100
Remarks
Has effect only when saving to JPEG. The value must be between 0 and 100. The default value is 100.public void setQuality(int value)
Jpeg format. The default value is 100
Remarks
Has effect only when saving to JPEG. The value must be between 0 and 100. The default value is 100.public int getImageType()
See ImageType.
public void setImageType(int value)
See ImageType.
public boolean isCellAutoFit()
Remarks
NOTE: This member is now obsolete. Instead, this property is not used, please remove this property.. This property will be removed 12 months later since August 2022. Aspose apologizes for any inconvenience you may have experienced.public void setCellAutoFit(boolean value)
Remarks
NOTE: This member is now obsolete. Instead, this property is not used, please remove this property.. This property will be removed 12 months later since August 2022. Aspose apologizes for any inconvenience you may have experienced.public boolean getOnePagePerSheet()
public void setOnePagePerSheet(boolean value)
public boolean getAllColumnsInOnePagePerSheet()
public void setAllColumnsInOnePagePerSheet(boolean value)
public DrawObjectEventHandler getDrawObjectEventHandler()
public void setDrawObjectEventHandler(DrawObjectEventHandler value)
public ImageFormat getChartImageType()
Remarks
NOTE: This member is now obsolete. Instead, Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality. This property will be removed 12 months later since June 2022. Aspose apologizes for any inconvenience you may have experienced.public void setChartImageType(ImageFormat value)
Remarks
NOTE: This member is now obsolete. Instead, Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality. This property will be removed 12 months later since June 2022. Aspose apologizes for any inconvenience you may have experienced.public java.lang.String getEmbededImageNameInSvg()
Remarks
NOTE: This member is now obsolete. Instead, please remove this property because images are now always embedded in Svg with base64 format. This property will be removed 12 months later since April 2025. Aspose apologizes for any inconvenience you may have experienced.public void setEmbededImageNameInSvg(java.lang.String value)
Remarks
NOTE: This member is now obsolete. Instead, please remove this property because images are now always embedded in Svg with base64 format. This property will be removed 12 months later since April 2025. Aspose apologizes for any inconvenience you may have experienced.public boolean getSVGFitToViewPort()
Remarks
NOTE: This member is now obsolete. Instead, please useSvgImageOptions.getFitToViewPort().
This property will be removed 12 months later since April 2025.
Aspose apologizes for any inconvenience you may have experienced.public void setSVGFitToViewPort(boolean value)
Remarks
NOTE: This member is now obsolete. Instead, please useSvgImageOptions.getFitToViewPort().
This property will be removed 12 months later since April 2025.
Aspose apologizes for any inconvenience you may have experienced.public java.lang.String getSvgCssPrefix()
Remarks
NOTE: This member is now obsolete. Instead, please useSvgImageOptions.getCssPrefix().
This property will be removed 12 months later since April 2025.
Aspose apologizes for any inconvenience you may have experienced.public void setSvgCssPrefix(java.lang.String value)
Remarks
NOTE: This member is now obsolete. Instead, please useSvgImageOptions.getCssPrefix().
This property will be removed 12 months later since April 2025.
Aspose apologizes for any inconvenience you may have experienced.public boolean getOnlyArea()
public void setOnlyArea(boolean value)
public void setRenderingHint(java.awt.RenderingHints.Key key,
java.lang.Object value)
key - the key of the hint to be set.value - the value indicating preferences for the specified hint category.public boolean getTransparent()
Remarks
The default value is false. That means the background of the generated images is white.public void setTransparent(boolean value)
Remarks
The default value is false. That means the background of the generated images is white.public IWarningCallback getWarningCallback()
public void setWarningCallback(IWarningCallback value)
public IPageSavingCallback getPageSavingCallback()
public void setPageSavingCallback(IPageSavingCallback value)
public boolean isFontSubstitutionCharGranularity()
Remarks
Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.public void setFontSubstitutionCharGranularity(boolean value)
Remarks
Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.public int getPageIndex()
Remarks
Default is 0.public void setPageIndex(int value)
Remarks
Default is 0.public int getPageCount()
Remarks
Default is System.Int32.MaxValue which means all pages will be rendered.public void setPageCount(int value)
Remarks
Default is System.Int32.MaxValue which means all pages will be rendered.public void setDesiredSize(int desiredWidth,
int desiredHeight)
Remarks
NOTE: This member is now obsolete. Instead, please usesetDesiredSize(int,int,boolean) by setting param keepAspectRatio to false.
This property will be removed 12 months later since May 2023.
Aspose apologizes for any inconvenience you may have experienced.desiredWidth - desired width in pixelsdesiredHeight - desired height in pixelspublic void setDesiredSize(int desiredWidth,
int desiredHeight,
boolean keepAspectRatio)
Remarks
desiredWidth - desired width in pixelsdesiredHeight - desired height in pixelskeepAspectRatio - whether to keep aspect ratio of origin imagepublic boolean isOptimized()
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.public void setOptimized(boolean value)
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.public java.lang.String getDefaultFont()
public void setDefaultFont(java.lang.String value)
public boolean getCheckWorkbookDefaultFont()
Remarks
Default is true.public void setCheckWorkbookDefaultFont(boolean value)
Remarks
Default is true.public boolean getOutputBlankPageWhenNothingToPrint()
Remarks
Default is false.public void setOutputBlankPageWhenNothingToPrint(boolean value)
Remarks
Default is false.public int getGridlineType()
See GridlineType.
Remarks
Default is Dotted type.public void setGridlineType(int value)
See GridlineType.
Remarks
Default is Dotted type.public Color getGridlineColor()
Remarks
It will ignore the gridline color settings in the source file.public void setGridlineColor(Color value)
Remarks
It will ignore the gridline color settings in the source file.public int getTextCrossType()
See TextCrossType.
public void setTextCrossType(int value)
See TextCrossType.
public int getDefaultEditLanguage()
See DefaultEditLanguage.
Remarks
It may display/render different layouts for text paragraph when different edit languages is set. Default isDefaultEditLanguage.AUTO.public void setDefaultEditLanguage(int value)
See DefaultEditLanguage.
Remarks
It may display/render different layouts for text paragraph when different edit languages is set. Default isDefaultEditLanguage.AUTO.public SheetSet getSheetSet()
SheetSet.getVisible().
Remarks
The set is ignored when it is used inSheetRenderpublic void setSheetSet(SheetSet value)
SheetSet.getVisible().
Remarks
The set is ignored when it is used inSheetRenderpublic int getEmfRenderSetting()
See 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. WhenEmfRenderSetting.EMF_PLUS_PREFER is set, then EMF+ records will be parsed while rendering to image, otherwise only EMF records will be parsed.
Default value is EmfRenderSetting.EMF_ONLY.
For the frameworks that depend on .Net System.Drawing.Common, this setting is ignored.public void setEmfRenderSetting(int value)
See 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. WhenEmfRenderSetting.EMF_PLUS_PREFER is set, then EMF+ records will be parsed while rendering to image, otherwise only EMF records will be parsed.
Default value is EmfRenderSetting.EMF_ONLY.
For the frameworks that depend on .Net System.Drawing.Common, this setting is ignored.public CustomRenderSettings getCustomRenderSettings()
public void setCustomRenderSettings(CustomRenderSettings value)
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.