0

hai , here in the below coding the files are merged , but the resulting format is stored as "encoded text" , i need the format to be ".doc" or ".rtf" files

Dim mydirpath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
       Dim txtlist As String() = Directory.GetFiles(mydirpath, "*.doc")
       Dim strfile As New StringBuilder
       Dim txtname As String
       For Each txtname In txtlist
           Using sr As New StreamReader(txtname)
               strfile.AppendLine(txtname.ToString())
               strfile.Append(sr.ReadToEnd())
               strfile.AppendLine()
           End Using
       Next
       Using outfile As New StreamWriter(mydirpath + "\output.doc")
           outfile.Write(strfile.ToString())
       End Using
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by G_Waddell
0

Hi
You will need to use office automation or the likes, it is not as simple as as text file where you append lines of plain unformatted text.

You may have to create a new blank word doc and populate it with the source of the other two.

Try starting here: http://support.microsoft.com/kb/316383

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.