在ASP.Net(C#)中怎么调用Excel的"预览"功能? up有分....

czhiyong_153650 2005-04-18 12:10:13
如题!!
给思路,给代码,给资料都好!
谢谢,up有分!!!
...全文
203 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
csulzw 2005-04-19
  • 打赏
  • 举报
回复
up
terryshi 2005-04-18
  • 打赏
  • 举报
回复
up
yufeng777 2005-04-18
  • 打赏
  • 举报
回复
UP
WTaoboy 2005-04-18
  • 打赏
  • 举报
回复
worksheet.PrintPreview
guanhua8 2005-04-18
  • 打赏
  • 举报
回复
我的一个导出EXECL类,你看看吧
Public Class Cexecl
'导出EXECL
Public Sub to_execl(ByVal response As System.Web.HttpResponse, ByVal HttpContext As System.Web.HttpContext, ByVal dgd_list As DataGrid, ByVal filename As String)
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename + ".xls")
response.ContentType = "application/vnd.ms-execl"
HttpContext.Current.Response.Charset = "GB2312"
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default
dgd_list.Page.EnableViewState = False
Dim tw As System.IO.StringWriter = New System.IO.StringWriter
Dim hw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(tw)
dgd_list.Visible = True
dgd_list.RenderControl(hw)
HttpContext.Current.Response.Write(tw.ToString())
HttpContext.Current.Response.End()
End Sub
Public Sub to_execl_list(ByVal response As System.Web.HttpResponse, ByVal HttpContext As System.Web.HttpContext, ByVal dgd_list As DataList, ByVal filename As String)
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename + ".xls")
response.ContentType = "application/vnd.ms-execl"
HttpContext.Current.Response.Charset = "GB2312"
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default
dgd_list.Page.EnableViewState = False
Dim tw As System.IO.StringWriter = New System.IO.StringWriter
Dim hw As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(tw)
dgd_list.Visible = True
dgd_list.RenderControl(hw)
HttpContext.Current.Response.Write(tw.ToString())
HttpContext.Current.Response.End()
End Sub
End Class
an_andy 2005-04-18
  • 打赏
  • 举报
回复
up,
czhiyong_153650 2005-04-18
  • 打赏
  • 举报
回复
up
lr2651 2005-04-18
  • 打赏
  • 举报
回复
up
syeerzy 2005-04-18
  • 打赏
  • 举报
回复
up
机器人 2005-04-18
  • 打赏
  • 举报
回复
Excel.ApplicationClass xlApp = new Excel.ApplicationClass();
object oMissing = System.Reflection.Missing.Value;
// 打开Excel文件。以下为Office 2000.
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(filePath, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing,
oMissing);
Excel.Worksheet xlWorksheet = xlWorkbook.Worksheets[0];
xlWorksheet.PrintPreview();
chongachong 2005-04-18
  • 打赏
  • 举报
回复
学习,帮你UP

62,067

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧