Skip to main content
A newer version of this page is available. .
All docs
V21.2
.NET Framework 4.5.2+
Row

WorksheetThumbnailOptions Class

Contains options used to generate a thumbnail from a worksheet.

Namespace: DevExpress.Spreadsheet

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

Declaration

public class WorksheetThumbnailOptions :
    SheetThumbnailOptions

Remarks

Use the WorksheetExtensions.CreateThumbnail extension method of a Worksheet object to save a worksheet as an image. Create a WorksheetThumbnailOptions instance and pass it to this method to specify thumbnail options.

Important

The WorksheetExtensions class is defined in the DevExpress.Docs.v21.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 save a worksheet as an image and set thumbnail options:

Create a thumbnail image of the worksheet

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

// Create a new Workbook object.
using (Workbook workbook = new Workbook())
{
    // Load a workbook from a file.
    workbook.LoadDocument("TopTradingPartners.xlsx", DocumentFormat.Xlsx);

    // Access an active worksheet.
    Worksheet worksheet = workbook.Worksheets.ActiveWorksheet;

    // Specify thumbnail options.
    var thumbnailOptions = new WorksheetThumbnailOptions
    {
        Resolution = 192,
        Scale = 80,
        Stretch = true,
        ColumnOffset = 1,
        RowOffset = 1,
        BackgroundColor = Color.FromArgb(0xF2, 0xF2, 0xF2)
    };

    // Create the worksheet's thumbnail and save it to a file.
    worksheet.CreateThumbnail("Worksheet_Thumbnail.png", ImageFileFormat.Png, 1600, 900, thumbnailOptions);
}

Inheritance

Object
SheetThumbnailOptions
WorksheetThumbnailOptions
See Also