Aug 3, 2020

2 min read

How to Convert ODS to JPG in C# .Net Framework

If you have been struggling with file format conversion, then today’s post will be right up your alley. We are going to be laying out an incredibly simple means by which you can begin converting your ODS files into nice convenient JPG images. And best of all, the whole setup process is only going to require about 5 minutes to complete.

Installation of our client library package is the first step.

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

Once that is out of the way, we can move on to calling our conversion function using an API instance.

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class ConvertDocumentOdsToJpgExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new ConvertDocumentApi();var inputFile = new System.IO.Stream(); // System.IO.Stream | Input file to perform the operation on.var quality = 56;  // int? | Optional; Set the JPEG quality level; lowest quality is 1 (highest compression), highest quality (lowest compression) is 100; recommended value is 75. Default value is 75. (optional)try{// Convert ODS Spreadsheet to JPG/JPEG image arrayOdsToJpgResult result = apiInstance.ConvertDocumentOdsToJpg(inputFile, quality);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentOdsToJpg: " + e.Message );}}}}

And now you’re done! Easy.