XLSB to JPEG – Convert XLSB to JPG in C#

XLSB to JPEG

Excel files are widely used for Data entry, Data management, Accounting, Financial analysis, etc. The data inside excel is comprised of numbers, formulas, text, and drawing shapes. Therefore, based on the data contained in excel files, users perform Data Analysis and Interpretation, Plenty of Formulas to Work with Data, Data organization, and Restructuring, Data Filtering, and much more. Similarly, the XLSB file is an Excel Binary Workbook file. It stores information in binary format instead of XML like with most other Excel files (like XLSX). It is believed that in Excel, the XLSX generally loads 4 times longer when compared to the XLSB, and saves 2 times slower followed by 1.5 times a bigger file. Therefore, it is one of the popular formats of Excel spreadsheets.

However, in order to view Excel files, you need to use certain applications such as Microsoft Office Excel Online, Apache OpenOffice Calc, LibreOffice Calc, etc. Furthermore, various versions of these applications may have different rendering behavior and also, the person receiving these files needs to have this application to view/open them. One viable solution is to render it in raster image format. JPEG is widely supported on major platforms including, Desktop, Mobile, Web. The fidelity of the document is not compromised when viewing JPEG/JPG images.

The three most common general uses for spreadsheet software are to create budgets, produce graphs and charts, and for storing and sorting data. Within business spreadsheet software is used to forecast future performance, calculate tax, completing basic payroll, producing charts, and calculating revenues.

Excel processing API

Aspose.Cells Cloud is our amazing API providing the capabilities to seamlessly enhance your native, web & cloud apps to provide spreadsheet processing functionality. Implement the feature to view, modify and convert Microsoft Excel & OpenOffice spreadsheets to other Supported File Formats. Perform the excel processing without MS Office automation or any other software installation. The API is so amazing that it enables you not only with worksheets, workbooks, spreadsheets, but even at rows, cells, charts, images, ListObjects, pivot tables, and tasks levels. Furthermore, as the API is built as per REST architecture, so it can be accessed on any platform including Windows, macOS, Linux, iOS, Android, etc. Also, you can use the Cloud API in any application type including Desktop, Console, Web, Mobile, Hybrid, etc.

Going one step further, we have created programming language-specific SDKs as wrappers around Cloud API. Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project.

Installation

Aspose.Cells Cloud SDK for .NET provides you the capabilities to process Excel files within the .NET application. In order to start using the Cloud SDK, you need to first perform the installation. It is available for download at NuGet and GitHub. Please execute the following command in the terminal window to perform the installation for NuGet:

nuget install Aspose.Cells-Cloud

When using .NET CLI:

dotnet add package Aspose.Cells-Cloud

Package Manager Console

If you are using Visual Studio, then the package can also be installed using Package Manager Console. Please execute the following command:

PM> Install-Package Aspose.Cells-Cloud
Aspose.Cells Cloud
Image 1:- Aspose.Cells NuGet package installed.

NuGet Package Manager – Visual Studio

Another easiest approach is to install the SDK via NuGet Package Manager within Visual Studio IDE.

  1. Open the Solution Explorer.
  2. Expand the project and Right-click Packages folder within your solution.
  3. Select Manage NuGet Packages… option
  4. Click on the Browse tab and search for “Aspose.Cells-Cloud
  5. Click on the Aspose.Cells-Cloud package, select the appropriate version in the right-tab and click Add Package button
Aspose.Cells Cloud Package
Image 2:- Aspose.Cells Package in NuGet Package Manager.

Cloud subscription

The Cloud API processes the documents either stored in Cloud storage or loaded in request objects from the local system. Get the output in the response object or save the output in Cloud storage. So in order to ensure the data security and integrity of files stored on cloud storage, only authorized persons can access them. So the users who upload their protected/personal files to cloud storage must only have access to those files. Furthermore, the subscription on cloud storage is free and you can perform up to 150 free document processing operations. So once you are satisfied with the capabilities of API, you may consider opting for a license subscription which can be as low as $0.005 / API call. For further details, please visit Pricing.

Now proceed with account creation by visiting Aspose.Cloud dashboard. No credit card or other payment details are necessary. If you have GitHub or Google account, simply Sign Up or, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Client Credentials
Image 3:- Client Credentials at Aspose.Cloud dashboard.

XLSB to JPEG in C#

Please follow the steps given below to perform the conversion:

  • First of all, please create an instance of CellsApi while passing ClientID and ClientSecret details as arguments
  • Secondly, create string variables defining input, resultant file and format of resultant file
  • Thirdly, create integer objects defining Horizonatal and Vertical resolutions for resultant output
  • Now load the XLSB to File.OpenRead instance
  • The next step is to initialize the conversion operation using CellsWorksheetsGetWorksheet(…) method. The output is in stream instance
  • Finally, use File.Create instance to save the output on system drive (as specified in saveToDisk(…) method).
Converted image
Image 4:- Preview of the resultant image.

The sample file used in the above example can be downloaded from TestCase.xlsb.

Convert XLSB to JPEG using cURL

As Aspose.Cells Cloud is built on REST architecture, so it can be accessed via the cURL commands. However, before proceeding further with API usage, we need to first generate a JWT access token based on Client ID and Client Secret specified over Aspose.Cloud dashboard. Please execute the following command to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=4db2f826-bf9c-42e7-8b2a-8cbca2d15553&client_secret=d757548a9f2558c39c2feebdf85b4c44" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Now next step is to perform the conversion of XSLB to JPEG using the cURL command. Please note the following command expects the file to be already available in cloud storage and you get the output in the Response object, which can be saved over system drive.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/TestCase.xlsb/worksheets/Sheet2?format=JPEG&verticalResolution=800&horizontalResolution=600" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-o myNewConverted.jpeg

Conclusion

In this article, we have discussed the features of Aspose.Cells Cloud API specific to the conversion of XLSB to JPEG. We have particularly discussed how we can perform the conversion using the C#.NET code snippet as well as the cURL command. To further facilitate our customers, the OpenAPI Specification defines a publicly accessible programming interface and lets you carry out REST interactions directly from a web browser.

Furthermore, our SDKs are open source and have an MIT license. You can use them, and even customize them absolutely free of charge. The complete source code is available over GitHub. While using the API, if you encounter any issues or you have any further queries, please feel free to contact us through the Free Customer Support forum.

Related articles

We also recommend visiting the following links to learn more about