odt to word

How to convert DOC to ODT Online

DOC files are created to save various documents, including letters, resumes, essays, and invitations. On the other hand, ODT files are types of documents created with word processing applications that are based on OpenDocument Text File format. These files hold text, images, objects, and style information and are supported by OpenOffice. In this article, we are going to discuss the steps on how to convert DOC file format to ODT using .NET REST API.

Word Conversion API

In order to process Word documents including DOC, DOT, DOCX, DOTX, DOTM, ODT, OTT, etc, and other major formats, we have specifically created Aspose.Words Cloud. It is based on REST architecture and can be used on several platforms (Windows, Linux, iOS, Android). You can use it to create, edit, merge, split, compare and convert Word documents to other Supported File Formats.

Furthermore, to facilitate our customers, we have created lightweight programming language-specific SDKs that provide a language-level interface to access Aspose.Words Cloud API and utilize the corresponding document-processing functionality in a manner consistent with language standards. So let’s focus on Aspose.Words Cloud SDK for .NET in this article.

Installation

To get started with using the Cloud SDK, installation is the first step. It is available for download NuGet and GitHub. In order to install the SDK from NuGet, please consider executing the following command in the terminal.

nuget install Aspose.Words-Cloud

NuGet Package Manager

You may also consider executing the following command in Package Manager Console in Visual Studio to fetch & reference Aspose.Words assembly in your project.

PM> Install-Package Aspose.Words-Cloud

After the installation, the next step is to create a new Account on the cloud dashboard using GitHub or Google accounts and obtain the Client Credentials details.

DOC to ODT in C#

Now that all set up and account configuration steps are complete, we can follow the instructions given below to convert the DOC file to ODT format using the C# .NET code snippet.

  • The first step is to create a Configuration object using Client credentials
  • Secondly, initialize WordsApi instance while passing Configuration object as argument
  • Thirdly, load the input DOC file into a stream object
  • Now initialize ConvertDocumentRequest instance which takes document stream and resultant format as arguments
  • In order to perform the conversion, call the ConvertDocument(…) method of WordsApi
  • Since the resultant file is in the Stream instance, so we will use saveToDisk(…) method to save output on the local drive
DOC to ODT preview

Image 2:- DOC to ODT conversion preview.

Please download the sample files used in the above example from sample.doc and conveted.odt.

Convert DOC to ODT using cURL

Owing to the REST architecture of Aspose.Words Cloud, it can also be accessed through the cURL commands. But before proceeding, we need to authenticate the user based on Client credentials. Therefore, first, we need to generate a JWT access token based on our personalized client credentials. Please execute the following command for JWT access token generation.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=4ccf1790-accc-41e9-8d18-a78dbb2ed1aa&client_secret=caac6e3d4a4724b2feb53f4e460eade3" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now execute the following command to perform the conversion operation:

curl -X PUT "https://api.aspose.cloud/v4.0/words/convert?format=ODT&outPath=Converted.odt&fileNameFieldValue=sourceFilename" \
-H  "accept: application/octet-stream" \
-H  "Authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"document":{}}

Conclusion

In this blog, we have discussed the details of how we can convert DOC files to ODT format using the C# .NET code snippet and through the cURL command. Please be noted that all our SDKs are offered under an MIT license, so a complete code snippet of Aspose.Words Cloud SDK for .NET can be downloaded from GitHub. In case you encounter any issue while using the API or you have any related queries, please feel free to contact us via the Free Support forum.

We also recommend visiting the following links to learn more about