[]
Represents options for exporting a worksheet, range, or shape to an image file.
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.
public class ImageSaveOptions
Public Class ImageSaveOptions
worksheet.Range["A1:B2"].Value = new object[,]
{
{ "Name", "Value" },
{ "Test", 100 }
};
ImageSaveOptions options = new ImageSaveOptions();
options.BackgroundColor = Color.Red;
options.ShowGridlines = true;
using MemoryStream stream = new MemoryStream();
worksheet.ToImage(stream, ImageType.PNG, options);
| Name | Description |
|---|---|
| ImageSaveOptions() |
| Name | Description |
|---|---|
| BackgroundColor | Gets or sets the background color of the exported image. This property specifies the color used when exporting a worksheet, range, or shape to an image. |
| BlackAndWhite | Gets or sets whether to save the image as a black and white image. |
| GridlineColor | Gets or sets the gridline color. |
| IncludeAutoMergedCells | Gets or sets whether to include automatically merged cells in the exported image. The default value is false. |
| Resolution | Gets or sets the resolution (in DPI) for jpeg image file. |
| ScaleX | Gets or sets the scale on the X axis. This value specifies the horizontal scaling used when exporting to an image. |
| ScaleY | Gets or sets the scale on the Y axis. This value specifies the vertical scaling used when exporting to an image. |
| ShowColumnHeadings | Gets or sets whether to display column headings. This option controls whether worksheet column headers are included when exporting to an image. |
| ShowDrawingObjects | Gets or sets whether to display drawing objects (charts, shapes, and pictures). This option controls whether drawing objects are included when exporting to an image. |
| ShowGridlines | Gets or sets whether to display gridlines. This property applies to image export scenarios that use ImageSaveOptions, such as exporting a worksheet or range to an image. |
| ShowRowHeadings | Gets or sets whether to display row headings. This property indicates whether row headings are included when exporting content to an image. |