Advertisement

Export Excel using NOPI and save the file on the server.

阅读量:
  1. NOPI下载

  2. 对压缩包进行解压操作,并将其中的dll文件纳入引用范围

  3. 引入以下命名空间,具体代码如图所示(该代码采用vb编写,如需转换为c#语言,只需调整声明方式即可。由于需要将生成的excel文件作为邮件附件进行发送,因此需将文件存储至服务器。然而,若持续如此操作,服务器上的文件数量将会不断增加。因此,在每次发送邮件前,会先清理服务器中对应用户名文件夹内的所有文件,然后再进行保存操作)

复制代码
    Imports BLL  
    Imports NPOI.XSSF.UserModel  
    Imports NPOI.SS.UserModel  
    Imports System.IO  
    Imports System.Data  
      
    Partial Class test  
    Inherits System.Web.UI.Page  
    Dim bll As New ReturnInfoBLL()  
    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click  
      

全部评论 (0)

还没有任何评论哟~