TXT is one windows attached text format, which is the most frequently used file format. It is used to the save text information and can be opened with several tools easily, for example, notepad, browser and so on.
Actually, there are a few formats for TXT file, for example, font style, size and color. Therefore, TXT file is suitable for saving plain text. Although TXT file doesn’t have many formats, it is still popular for easily to open and read.
Convert Word to TXT
Sometimes, because users need to have a plain text file for submitting to website, they may convert Word document to TXT.
In this post, I will introduce a method about how to convert Word to TXT by using C#/VB.NET.
Note: Spire.Doc is used in this example. If you want to use the following code, please download and install this component firstly. Then, add its dll file as reference in project.
Detailed Steps Shown as Following:
I. Load file which I want to convert to TXT by using document.LoadFromFile() method.
Document document = new Document();
Dim document As New Document()
II. Convert Word to TXT by using document.SaveToFile() method. There are two parameters passed to this method, file name format and file format. Extension of file name should be .txt and file format should be .Txt as well.
III. Launch the saved txt file.
Result Shown as Following:
Click Here to LEARN MORE about Spire.Doc
Click Here to DOWNLOAD Spire.Doc
Spire.Office also can be used to realize this function.