# Saving to an Image File

Discover how to create and save an image instance in an image format using cell ranges in a worksheet.

## Content



You can save data in an image file by creating a bitmap instance using the [SheetView.SaveImage](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.SaveImage.html) class method. This method saves all the data in the specified cell range in an image.

Users can provide parameters such as row, column, rowcount, colcount, height, and width. A Bitmap instance is returned as output and it represents the image of the range.

The bitmap instance can be saved to an image file by using the **Save** method. It can also be utilized in the following ways:

*   Paint as a graphic.
*   Use as an image source.

The following GIF illustrates saving a cell range to an image file.

![Create images in Spread for Winforms](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/export-range-to-image.gif)

The following code example shows how to create an image using cell ranges in a worksheet and save the image instance in an image format.

```csharp
// Make sure that fpSpread1.LegacyBehaviors does not contain LegacyBehaviors.Style
fpSpread1.Features.EnhancedShapeEngine = true;

fpSpread1.Sheets[0].Cells[0, 0].Text = "Spread";
fpSpread1.Sheets[0].Cells[0, 1].Text = "For";
fpSpread1.Sheets[0].Cells[0, 2].Text = "Winforms";
fpSpread1.BorderCollapse = FarPoint.Win.Spread.BorderCollapse.Enhanced;
            
var bitmap = fpSpread1.ActiveSheet.SaveImage(0, 0, 3, 3);
bitmap.Save("D:\\sample\\Img.png", System.Drawing.Imaging.ImageFormat.Png);
```

```vbnet
' Make sure that fpSpread1.LegacyBehaviors does Not contain LegacyBehaviors.Style
FpSpread1.Features.EnhancedShapeEngine = True

FpSpread1.Sheets(0).Cells(0, 0).Text = "Spread"
FpSpread1.Sheets(0).Cells(0, 1).Text = "For"
FpSpread1.Sheets(0).Cells(0, 2).Text = "Winforms"
FpSpread1.BorderCollapse = FarPoint.Win.Spread.BorderCollapse.Enhanced

Dim bitmap = FpSpread1.ActiveSheet.SaveImage(0, 0, 3, 3)
bitmap.Save("D:\sample\Img.png", Imaging.ImageFormat.Png)
```

## See Also

[Saving to a Spread XML File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-spreadfile)

[Saving to an Excel File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-excelfile)

[Saving to a PDF File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-pdffile)

[Saving to a Text File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-texttfile)

[Saving to an HTML File](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-htmlfile)

[Adding Custom Properties](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-add-custom-property)

[Saving to an HTML Table](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-htmltable)

[Saving Spreadsheet Data to Simple XML](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-usefiles/spwin-savefiles/spwin-save-dataxml)