Thanks guys, I haven't tried System.IO.File.Move("c:\test.txt",
"c:\test.xls") yet, but I have found that the following code will magically
produce an Excel file with cells A1:A5 populated: This is not documented
anywhere, I just tried it to see what would happen!
Dim pathAndFileName As String = Server.MapPath("Data/Test.xls")
Dim sr As StreamWriter = File.CreateText(pathAndFileName)
Dim xData, str_1,str_2,str_3,str_4,str_5 As String
str_1="This"
str_2="is"
str_3="a"
str_4="Test"
xData = "str_1 & vbTab & str_2 & vbTab & str_3 & vbTab & str_4
sr.WriteLine(xData)
sr.Close()
"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:O7**************@TK2MSFTNGP04.phx.gbl...
Hi,
Augustin Prasanna wrote:
Steve,
System.IO.File.Move("c:\test.txt", "c:\test.xls")
If the text file is really just a text file, changing its extension will
not convert it to an excel file magically...
If you have a text file, you'll need to parse it and insert the data in
the Excel file. Fortunately, you can use ADO.NET to connect to Excel
files like to a DB (though with some restrictions), so it's not that
complicated to interact with Excel files even in environments where
Excel itself is not available or cannot be automated.
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch