How to C#: Converter
Use Convert SDK for C#
Microsoft Excel to Image
Microsoft Excel to Image
  |  
Home ›› XDoc.Converter ›› C# Converter: Excel to Raster Image

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.




C# DLLs for Excel Conversion to Images


Add necessary references to your C# project:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.DICOM.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.JBIG2.dll


  RasterEdge.Imaging.JPEG2000.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Converter.dll


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.XDoc.PDF.dll


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XDoc.TIFF.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.AdvancedCleanup.Core.dll


  RasterEdge.XImage.OCR.dll


  RasterEdge.XImage.OCR.Tesseract.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use the namespaces


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Converter;




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.




// Used to register all DLL assemblies.
WorkRegistry.Reset();

// 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);




How to: Excel to Gif Conversion in C#



If you want to transform Excel document to Gif raster image, try this. This demo code just convert first Excel page to Gif image




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

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



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




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

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