use Microsoft Office Web Components 9.0 COM
eg for Excel:
Imports System.Data.OleDb
Imports OWC
<!--StartFragment-->Dim xlsheet As New SpreadsheetClass()
cnn.Open()
Dim reader As OleDbDataReader = Me.sql.ExecuteReader()
Dim numbercols As Integer = reader.FieldCount
Dim row As Integer = 2
Dim i As Integer = 0
For i = 0 To numbercols - 1
xlsheet.ActiveSheet.Cells(1, i + 1) = reader.GetName(i).ToString()
Next
While (reader.Read())
For i = 0 To numbercols - 1
xlsheet.ActiveSheet.Cells(row, i + 1) =
reader.GetValue(i).ToString()
Next
row = row + 1
End While
reader.Close()
cnn.Close()
Try
xlsheet.ActiveSheet.Export(Server.MapPath(".") + "\Images\" +
Me.xlfile.Text,_
OWC.SheetExportActionEnum.ssExportActionNone)
Catch e As System.Runtime.InteropServices.COMException
Response.Write("error£º" + e.Message)
End Try
"Remco Ploeg" <Re********@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ
:B7**********************************@microsoft.co m...
Hi,
I have a question about generating a word document from a template
document in a web control / web part. I'am using now the aspose.word dll's but for
this solution we have to pay a lot of money.
I searched the internet for a couple of days now, for a good example how
to render a word document based on a template and updating mergefields in
that new generated document. Does anybody known a good solution for this? Of
some url's .....I found only 1 example about a windows forms.
I want to use c#, but an example with vb is also good.
--
thanks,
Remco Ploeg