XDoc.Converter
Features
Tech Specs
How-to C#
Pricing

C# Document Converter Library
C# Image Convert: How to Convert Excel to Raster Images (Jpeg, Png, Bmp, & Gif)


Respective C# Examples for Excel Document to Jpeg, Png, Bmp, and Gif Images Conversion





If you want to convert Office Excel to raster image files (Jpeg, Png, Bmp and Gif) in your C# application, two aspects may be taken into consideration. One is only rendering a defined Excel sheet/page to a raster image. And the other is rendering the whole Excel file to a series of raster images. Considering that Excel document page/sheet has its own size, you need to set resolution for converted raster image.


How to: Excel to Jpeg Conversion in C#



This demo explains how to use C# class code to perform Excel to Jpeg conversion. This demo code just convert first Excel page to Jpeg image.

String inputFilePath = @"C:\input.xlsx";
String outputFilePath = @"C:\output.jpg";

// Convert Excel to Jpeg.
ConvertResult result = DocumentConverter.ToImage(inputFilePath, outputFilePath, FileType.IMG_JPEG);


C# sample code for MS Excel to Jpeg image conversion. This demo code convert Excel file all pages to Jpeg images.

// Define input and output files path.
String inputFilePath = @"C:\input.xlsx";
String outputDirectory = @"C:\output\";

// Convert Word to Jpeg and show conversion result.
ConvertResult result = DocumentConverter.ToImages(inputFilePath, outputDirectory, "output", FileType.IMG_JPEG);


How to: Excel to Png Conversion in C#



By using this C# demo code, you can easily convert Excel file to Png raster image. This demo code just convert first Excel page to Png image.

// Define input and output files path.
String inputFilePath = @"***.xlsx";
String outputFilePath = @"***.png";

// Convert Excel to Png.
ConvertResult result = DocumentConverter.ToImage(inputFilePath, outputFilePath, FileType.IMG_PNG);

// ...


C# sample code for MS Excel to Png image conversion. This demo code convert Excel file all pages to Png images.

// Define input and output files path.
String inputFilePath = @"C:\input.xlsx";
String outputDirectory = @"C:\output\";

// Convert Excelto Png and show conversion result.
ConvertResult result = DocumentConverter.ToImages(inputFilePath, outputDirectory, "output", FileType.IMG_PNG);


How to: Excel to Bmp Conversion in C#



This is an example of converting Excel to Bmp using C# programming language. This demo code just convert first Excel page to Bmp image

String inputFilePath = @"C:\input.xlsx";
String outputFilePath = @"C:\output.png";

// Convert Excel to Bmp.
ConvertResult result = DocumentConverter.ToImage(inputFilePath, outputFilePath, FileType.IMG_BMP);


C# sample code for MS Excel to Bmp image conversion. This demo code convert Excel file all pages to Bmp images.

// Define input and output files path.
String inputFilePath = @"C:\input.xlsx";
String outputDirectory = @"C:\output\";

// Convert Excelto Bmp and show conversion result.
ConvertResult result = DocumentConverter.ToImages(inputFilePath, outputDirectory, "output", FileType.IMG_BMP);