Worksheet to Image in C#, VB.NET

Making a Microsoft Excel worksheet to an image file can be quite useful when you might need to use an image of a worksheet in an application or web page. This can be the most effective solution for developers to convert worksheet to image as this solution converts Excel spreadsheets-including all text, formatting and diagrams-to graphic files.

Spire.XLS for .NET supports converting Excel worksheets to images. To use this feature, you need to invocate the method - public void SaveToImage(string fileName) in your program or project. You can convert a worksheet to image file(s) with different attributes or options and you can save the image file to disk. Most image formats are supported, such as BMP, PNG, GIF, JPG, JPEG, TIFF, and etc.

  • Create a new workbook
  • Load information from excel file and transfer into workbook
  • Save workbook as any image file format at your will

Below is an effective screenshot of the target . png image from Excel spreadsheet.

Excel to Image

Download Spire.XLS for .NET (or Spire.Office) with .NET Framework 2.0 (or above) together. In your application add Spire.XLS reference. The following code snippet shows how to convert an Excel worksheet to an image in C#, VB.NET.

using Spire.Xls;
namespace Xls2Image

    class Program
        static void Main(string[] args)
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];
Imports Spire.Xls
Namespace Xls2Image
       Friend Class Program
              Shared Sub Main(ByVal args() As String)
                     Dim workbook As New Workbook()
                     Dim sheet As Worksheet = workbook.Worksheets(0)
              End Sub
       End Class
End Namespace