In order to share data with others, we can save data in Excel and send it to other via E-mail. Sometimes, people may not send the Excel file, but convert it to other format, for example, image.
If we convert Excel to image, the data cannot be formatted and modified directly. Also, we can insert image in blog posts or articles for showing data more intuitively. In this post, I will show the method to convert Excel to image with C# via Spire.XLS.
Firstly, download and install Spire.XLS on your computer.
Secondly, add Spire.XLS DLL file as reference after creating a new project.
Thirdly, load Excel file which we would like to convert to image. In this example, I choose the file about student information.
Fourthly, initialize worksheet. Then, save Excel to image by using sheet.SaveToImage(); I save the format as jpg. Also, we can set the image as other format, such as bmp or gif.
Finally, launch this converted image.
Using the Code:
static void Main(string args)
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"D:\work\My Documents\Student Info.xlsx",ExcelVersion.Version2010);
Worksheet sheet = workbook.Worksheets;
//Save and Launch Image
After running, we can the image as following: