Back to Devexpress

RangeImageOptions Class

officefileapi-devexpress-dot-spreadsheet-3fd75565.md

latest2.7 KB
Original Source

RangeImageOptions Class

Contains options used to export a cell range to an image.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public class RangeImageOptions
vb
Public Class RangeImageOptions

Remarks

Use the CellRangeExtensions.ExportToImage extension method of a CellRange object to save a cell range as an image. Create a RangeImageOptions instance and pass it to this method to specify export options.

Important

The CellRangeExtensions class is defined in the DevExpress.Docs.v25.2.dll assembly. You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this assembly in production code.

The following example demonstrates how to export a cell range to an image:

csharp
using DevExpress.Spreadsheet;
using System.Drawing;
// ...

var exportOptions = new RangeImageOptions
{
    Resolution = 192,
    ExportHeadings = true,
    ExportGridlines = true,
    GridlineColor = Color.Gray,
    BackgroundColor = Color.FromArgb(0xF2, 0xF2, 0xF2)
};
worksheet.Range["B1:I25"].ExportToImage("RangeImage.png", ImageFileFormat.Png, exportOptions);
vb
Imports DevExpress.Spreadsheet
Imports System.Drawing
' ...

Dim exportOptions As New RangeImageOptions With {
    .Resolution = 192,
    .ExportHeadings = True,
    .ExportGridlines = True,
    .GridlineColor = Color.Gray,
    .BackgroundColor = Color.FromArgb(&HF2, &HF2, &HF2)
}
worksheet.Range("B1:I25").ExportToImage("RangeImage.png", ImageFileFormat.Png, exportOptions)

Inheritance

Object RangeImageOptions

See Also

RangeImageOptions Members

DevExpress.Spreadsheet Namespace