How to Convert ODP Files to PPTX Format in C# .NET
At a high level, Open Document Presentations (ODP) and PowerPoint presentations (PPTX) are fairly similar content types. The latter has considerably more advanced features to offer, however, so we might benefit from having a quick way to convert our ODP files to PPTX at scale.
Using the below code, we can take advantage of a free API to carry out ODP to PPTX conversions in our C# .NET application. Writing our own code for this type of conversion can be cumbersome and resource-intensive; with a low-code API solution, we won’t need to waste any time getting our conversion workflow up and running.
To get started, let’s install the SDK. We can install via NuGet by running the below command in our Package Manager console:
Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.4.2
Next, before we implement code to call the function, let’s acquire a free API key to authorize our requests. Free-tier API keys allow a limit of 800 API calls per month with zero commitments; once we reach our limit, our total will simply reset the following month.
Now let’s go ahead and copy the below code examples to call our function. Let’s include our API key and file data:
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 ConvertDocumentOdpToPptxExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new ConvertDocumentApi();
var inputFile = new System.IO.FileStream("C:\\temp\\inputfile", System.IO.FileMode.Open); // System.IO.Stream | Input file to perform the operation on.
try
{
// Convert ODP Presentation to PPTX
byte[] result = apiInstance.ConvertDocumentOdpToPptx(inputFile);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentOdpToPptx: " + e.Message );
}
}
}
}
Now we can easily convert ODP to PPTX in our own C# .NET applications. No more code required!