Convert Excel Chart as an Image


In this article I will explain converting excel chart as an image in a simple way.

Open Visual Studio >> File >> New >>Project choose console application from C# Project Window.

Image1.gif

Right click on ExcelChartToImage solution and select Add Reference.

Image2.gif

In Add reference window Select Excel 12.0 Object Library from .Net tab.

image3.gif

Click on Ok button to add excel reference.

Add following namespace on the header of Program.cs file.

using xl = Microsoft.Office.Interop.Excel;

Add following code to convert Excel chart as an image.

image4.gif

GetChart contains following arguments

  1. strFilePath- Give path of excel file i.e. "C:\xlChart.xlsx".
  2. strDestPath- Give the destination image file path i.e. c:\xlChart.jpeg.

To release com object add following code:

image5.gif

Please download complete code for convert excel chart as image.

Thanks for reading article..


Similar Articles