The Syncfusion .NET Excel (XlsIO) library makes it easy to convert Excel to image in C#. With this library, you can effortlessly export and save worksheet content in PNG, JPG, and BMP image formats. This feature proves valuable in various scenarios where you need to share or display the worksheet content beyond Microsoft Excel, such as in presentations, websites, and documents.
The Excel to image conversion feature works seamlessly on these platforms: Windows Forms, ASP.NET, ASP.NET MVC, WPF, UWP, .NET, Xamarin, Blazor, WinUI, and .NET MAUI.
Here is an example of how to convert an Excel document to an image in C# using the Syncfusion.NET Excel library.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
using (FileStream excelStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read))
{
IWorkbook workbook = application.Workbooks.Open(excelStream);
IWorksheet sheet = workbook.Worksheets[0];
//Initialize the XlsIO renderer
application.XlsIORenderer= new XlsIORenderer();
//Save the image into a stream
using (MemoryStream stream = new MemoryStream())
{
//Convert the worksheet into an image
sheet.ConvertToImage(1, 1, 10, 20, stream);
}
}
}
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.