[]
Use this class to control image export settings such as scale, resolution, background color, gridline display, row and column headings, drawing objects, black-and-white output, and whether automatically merged cells are included.
worksheet.getRange("A1:B2").setValue(new Object[][] {
{"Name", "Value"},
{"North", 120}
});
ImageSaveOptions options = new ImageSaveOptions();
options.setBackgroundColor(Color.FromArgb(255, 0, 0));
options.setShowGridlines(true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
worksheet.toImage(stream, ImageType.PNG, options);
booleanvoidsetBackgroundColor(Color backgroundColor) voidsetBlackAndWhite(Boolean blackAndWhite) voidsetGridlineColor(Color gridlineColor) voidsetIncludeAutoMergedCells(boolean value) voidsetResolution(Integer resolution) voidvoidvoidsetShowColumnHeadings(Boolean showColumnHeadings) voidsetShowDrawingObjects(Boolean showDrawingObjects) voidsetShowGridlines(Boolean showGridlines) voidsetShowRowHeadings(Boolean showRowHeadings) This property specifies the color used when exporting a worksheet, range, or shape to an image. If no background color has been assigned, this method returns null.
ImageSaveOptions options = new ImageSaveOptions();
options.setBackgroundColor(Color.FromArgb(255, 0, 0));
Color backgroundColor = options.getBackgroundColor();
null if no background color has been set.This property specifies the color used when exporting a worksheet, range, or shape to an image. If no background color has been assigned, this method Sets null.
ImageSaveOptions options = new ImageSaveOptions();
options.setBackgroundColor(Color.FromArgb(255, 0, 0));
backgroundColor - The background color of the exported image. Sets null if no background color has been set.This property indicates whether row headings are included when exporting content to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowRowHeadings(true);
Boolean showRowHeadings = options.getShowRowHeadings();
Boolean that indicates whether row headings are displayed.This property indicates whether row headings are included when exporting content to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowRowHeadings(true);
showRowHeadings - A Boolean that indicates whether row headings are displayed.This option controls whether worksheet column headers are included when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowColumnHeadings(true);
Boolean showColumnHeadings = options.getShowColumnHeadings();
true to display column headings; false to hide them; or null if this option has not been explicitly set.This option controls whether worksheet column headers are included when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowColumnHeadings(true);
showColumnHeadings - true to display column headings; false to hide them; or null if this option has not been explicitly set.This property applies to image export scenarios that use ImageSaveOptions, such as exporting a worksheet or range to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowGridlines(true);
Boolean showGridlines = options.getShowGridlines();
true to display gridlines in the exported image; otherwise, false.This property applies to image export scenarios that use ImageSaveOptions, such as exporting a worksheet or range to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowGridlines(true);
showGridlines - true to display gridlines in the exported image; otherwise, false.This option controls whether drawing objects are included when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowDrawingObjects(Boolean.TRUE);
Boolean showDrawingObjects = options.getShowDrawingObjects();
Boolean.TRUE to display drawing objects; Boolean.FALSE to hide them; or null if this option has not been explicitly set.This option controls whether drawing objects are included when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setShowDrawingObjects(Boolean.TRUE);
showDrawingObjects - Boolean.TRUE to display drawing objects; Boolean.FALSE to hide them; or null if this option has not been explicitly set.This value specifies the horizontal scaling used by ImageSaveOptions when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setScaleX(0.5);
Double scaleX = options.getScaleX();
This value specifies the horizontal scaling used by ImageSaveOptions when exporting to an image.
ImageSaveOptions options = new ImageSaveOptions();
options.setScaleX(0.5);
scaleX - The scale on the X axis.This value specifies the vertical scaling used by ImageSaveOptions when exporting to an image. If no Y-axis scale has been assigned, this method returns null.
ImageSaveOptions options = new ImageSaveOptions();
options.setScaleY(0.75);
Double scaleY = options.getScaleY();
null if no Y-axis scale has been set.This value specifies the vertical scaling used by ImageSaveOptions when exporting to an image. If no Y-axis scale has been assigned, this method Sets null.
ImageSaveOptions options = new ImageSaveOptions();
options.setScaleY(0.75);
scaleY - The scale on the Y axis. Sets null if no Y-axis scale has been set.This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to a JPEG image.
ImageSaveOptions options = new ImageSaveOptions();
options.setResolution(192);
Integer resolution = options.getResolution();
This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to a JPEG image.
ImageSaveOptions options = new ImageSaveOptions();
options.setResolution(192);
resolution - The resolution, in DPI, for JPEG image export.This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to an image file.
ImageSaveOptions options = new ImageSaveOptions();
options.setBlackAndWhite(true);
Boolean blackAndWhite = options.getBlackAndWhite();
true if exported images are saved as black and white; otherwise, false.This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to an image file.
ImageSaveOptions options = new ImageSaveOptions();
options.setBlackAndWhite(true);
blackAndWhite - true if exported images are saved as black and white; otherwise, false.This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to an image. If no gridline color has been assigned, this method returns null.
ImageSaveOptions options = new ImageSaveOptions();
options.setGridlineColor(Color.FromArgb(0, 0, 255));
Color gridlineColor = options.getGridlineColor();
null if no gridline color has been set.This property is used by ImageSaveOptions when exporting a worksheet, range, or shape to an image. If no gridline color has been assigned, this method Sets null.
ImageSaveOptions options = new ImageSaveOptions();
options.setGridlineColor(Color.FromArgb(0, 0, 255));
gridlineColor - The gridline color used for exported images. Sets null if no gridline color has been set.This option applies to auto-merge information added by IWorksheet.autoMerge(IRange,AutoMergeDirection,AutoMergeMode,AutoMergeSelectionMode). The default value is false.
ImageSaveOptions options = new ImageSaveOptions();
options.setIncludeAutoMergedCells(true);
boolean includeAutoMergedCells = options.getIncludeAutoMergedCells();
true if automatically merged cells are included when exporting to an image; otherwise, false.This option applies to auto-merge information added by IWorksheet.autoMerge(IRange,AutoMergeDirection,AutoMergeMode,AutoMergeSelectionMode). The default value is false.
ImageSaveOptions options = new ImageSaveOptions();
options.setIncludeAutoMergedCells(true);
value - true if automatically merged cells are included when exporting to an image; otherwise, false.