Skip to main content
All docs
V24.2
Row

WorksheetThumbnailOptions Class

Contains options used to generate a thumbnail from a worksheet.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

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.v24.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