In various scenarios, you may want to convert Excel spreadsheets to high-resolution images, for example, when you need to embed the spreadsheet content within your web or desktop applications. In this article, you will learn how to convert Excel XLSX or XLS to images using C# from within the .NET applications.
- C# Excel to Image Converter API
- Excel to Image C# Conversion
- Convert Excel to Image Online
- Get Free License
C# Excel to Image Converter API
Aspose.Cells for .NET is a C# class library that is designed to create and manipulate MS Excel spreadsheets. In addition to spreadsheet automation and manipulation features, the API also provides a built-in converter to convert Excel worksheets to image formats. You can either download the API’s DLL or install it using NuGet.
PM> Install-Package Aspose.Cells
Convert Excel XLSX to Image in C#
Aspose.Cells for .NET allows you to convert Excel worksheets into various popular image formats. The list includes:
The following are the steps to convert an Excel worksheet to image using Aspose.Cells for .NET.
- Load the Excel file using Workbook class.
- Create an instance of ImageOrPrintOptions class.
- Set image type using ImageOrPrintOptions.ImageType property.
- Use ImageType enumeration to select the format of the output image such as JPEG, PNG, etc.
- Select the worksheet you want to render in the Worksheet object.
- Create an object of SheetRender and pass the Worksheet and ImageOrPrintOptions objects to its constructor.
- Loop through the pages using SheetRender.PageCount property to save each page as image using SheetRender.ToImage(Int32, String) method.
The following code sample shows how to convert an Excel worksheet to an image using C#.
Convert Excel to Image Online
Use our free online Excel to image converter tool, which is based on Aspose.Cells. You can use it from anywhere only having an internet connection.
Get Free Excel to Image Converter
You can get a free temporary license to use Aspose.Cells for .NET without evaluation limitations.
Conclusion
In this article, you have learned how to convert MS Excel XLSX or XLS files to images using C#. Furthermore, you can convert the Excel files to JPEG, PNG, BMP, TIFF, EMF, and other popular image formats seamlessly. We have also provided you with an online Excel to image converter app that is free and can be used without creating an account.
In order to explore more about the C# Excel API, visit the documentation.