How to convert a Word DOC 97–03 Document to Text TXT in C# .NET Framework

Cloudmersive
1 min readFeb 23, 2020

--

Working with older file types can be very inconvenient. That’s why today’s lesson is on how to convert legacy DOC files from old versions of Microsoft Word into more useful TXT files.

Our client installation needs to come first on our list. That just means activating this command in your Package Manager console.

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

Alright, now we just have to call ConvertDocumentDocToTxt and give it our DOC file.

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 ConvertDocumentDocToTxtExample{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.try{// Convert Word DOC (97-03) Document to Text (txt)TextConversionResult result = apiInstance.ConvertDocumentDocToTxt(inputFile);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertDocumentApi.ConvertDocumentDocToTxt: " + e.Message );}}}}

And that’s all there is to it. Seriously, you’re done. For all your API needs, check out the rest of this tutorial series.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet