B
Ben
Hi,
I use FileStream to write data to excel 2003. It works good but I have two
problems:
1) the data written to excel come from a database. When i write the actual
data to excel, and then later and without closing the browser, i do it again
with the updated database (more or modified records), i still get the
records as sent the first time. I have to close the browser, then restarting
it to get the updated records in excel. Why is that and how to avoid closing
the browser?
2) now we use excel 2007 and there is an error saying something that the
version is not correct ..but excel 2007 opens with the written data.
The code: (vb.net)
Dim objFileStream As FileStream
Dim objStreamWriter As StreamWriter
fileExcel = "mysheet.xls" (with this: fileExcel = "mysheet.xlsx", excel 2007
doesn't open at all)
filePath = Server.MapPath("\myapp\excel")
fileName = filePath & "\" & fileExcel
objFileStream = New FileStream(fileName, FileMode.OpenOrCreate,
FileAccess.Write)
objStreamWriter = New StreamWriter(objFileStream)
objStreamWriter.WriteLine("this line must come into excel")
objStreamWriter.Close()
objFileStream.Close()
What have to change here for excel 2007 (except the "xlsx")?
Thanks
Ben
I use FileStream to write data to excel 2003. It works good but I have two
problems:
1) the data written to excel come from a database. When i write the actual
data to excel, and then later and without closing the browser, i do it again
with the updated database (more or modified records), i still get the
records as sent the first time. I have to close the browser, then restarting
it to get the updated records in excel. Why is that and how to avoid closing
the browser?
2) now we use excel 2007 and there is an error saying something that the
version is not correct ..but excel 2007 opens with the written data.
The code: (vb.net)
Dim objFileStream As FileStream
Dim objStreamWriter As StreamWriter
fileExcel = "mysheet.xls" (with this: fileExcel = "mysheet.xlsx", excel 2007
doesn't open at all)
filePath = Server.MapPath("\myapp\excel")
fileName = filePath & "\" & fileExcel
objFileStream = New FileStream(fileName, FileMode.OpenOrCreate,
FileAccess.Write)
objStreamWriter = New StreamWriter(objFileStream)
objStreamWriter.WriteLine("this line must come into excel")
objStreamWriter.Close()
objFileStream.Close()
What have to change here for excel 2007 (except the "xlsx")?
Thanks
Ben