用asp.net直接生成word excel,而且不下载,直接打开
使用asp.net写这么一个功能
通过asp.net生成一个word 或者 excel,并在写入想要加入的内容,要带格式的
然后不用下载,直接打开
求高手给一个比较详尽的例子
------解决方案--------------------找个控件接住~~
------解决方案--------------------能不能直接打开不是你控制得了的,要看客户端有没有安装相应的office软件,没有就会提示下载文件
------解决方案-------------------- 我的可用的代码(生成excel报表)
Dim xlBooks As Excel.Workbooks, xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
' Dim rowIndex, colIndex As Integer
Dim spath As String
spath = Server.MapPath("./")
spath = spath & "uploads\book1.xls"
'missing2 = missing.Value
xlApp.Visible = False
' xlBook = xlApp.Workbooks().Add
xlApp.DisplayAlerts = False
xlBooks = xlApp.Workbooks
xlBooks.Open(spath)
xlBook = xlBooks.Item(1)
'xlBook = xlApp.Application.Workbooks.Open("rep1.xlt", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
xlSheet = xlBook.Worksheets("sheet1")
'处理数据 。。。。
ds = Funlib.MyQueryUsesqlDataSet(ss, "temp")
If ds.Tables("temp").Rows.Count > 0 Then
xlApp.Cells(1, 3) = Tb.Text.Trim & "报表"
xlApp.Cells(2, 3) = CStr(Funlib.getdate())
xlApp.Cells(3, 2) = "等级"
xlApp.Cells(3, 1) = "序号"
&