PNG
JPG
BMP
TIFF
XLSX
Parse XLSX Formats in C#
Native and high performance XLSX document parsing using server-side Aspose.Cells for .NET APIs, without the use of any software like Microsoft or Adobe PDF.
How to Parse XLSX File Using C#
In order to parse XLSX file, we’ll use Aspose.Cells for .NET API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open NuGet package manager, search for Aspose.Cells and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Cells
Steps to Parse XLSX Files in C#
A basic document parsing with Aspose.Cells for .NET APIs can be done with just few lines of code. Parse text & images from Microsoft Excel XLS, XLSX, XLSM, XLSB and OpenDocument ODS files.
- Load XLSX document.
- Select sheet.
- Get the picture and image type.
- Save the image.
- Save document
System Requirements
Our APIs are supported on all major platforms and Operating Systems. Before executing the code below, please make sure that you have the following prerequisites on your system.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Mono or Xamarin Platforms
- Development environment like Microsoft Visual Studio
- Add reference to the Aspose.Cells for .NET DLL in your project - Install from NuGet using the Download button above
Parse XLSX Files - C#
// extract images from Worksheets
// open a template Excel file
Workbook workbook = new Workbook("sampleExtractImagesFromWorksheets.xlsx");
// get the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// get the first Picture in the first worksheet
Aspose.Cells.Drawing.Picture pic = worksheet.Pictures[0];
// set the output image file path
string picformat = pic.ImageType.ToString();
// Note: you may evaluate the image format before specifying the image path
// define ImageOrPrintOptions
Aspose.Cells.Rendering.ImageOrPrintOptions printoption = new Aspose.Cells.Rendering.ImageOrPrintOptions();
// specify the image format
printoption.ImageType = Aspose.Cells.Drawing.ImageType.Jpeg;
// save the image
pic.ToImage("outputExtractImagesFromWorksheets.jpg", printoption);