Click here to Skip to main content
16,016,489 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to convert .txt file to .doc and .docx format. I have added code by creating txt file, Kindly proceed by this code.
VB
Dim text As String = ""
           Dim files() As String = IO.Directory.GetFiles(sfilename)
           For Each sFile As String In files

               If sFile.Contains(".txt") Then
                   text &= IO.File.ReadAllText(sFile) & vbNewLine
               End If
           Next
           Dim objStreamWriter As StreamWriter
           Dim txtfilename As String
             txtfilename = sfilename  & ".txt"
           objStreamWriter = New StreamWriter(txtfilename)
           objStreamWriter.WriteLine(text)
           objStreamWriter.Close()
Posted
Updated 7-Jan-14 8:35am
v2

1 solution

You have to create the Word Document and then add to it the content of the file you've read. See , for instance "How to automate Word from Visual Basic .NET to create a new document" at MSDN[^].
 
Share this answer
 
Comments
vinodh107 7-Jan-14 23:09pm    
we do have any other way instead of writing cell by cell.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900