这几天碰到一个需求就是导出到Excel文件

用到Aspose

Aspose,学习笔记

//Create a workbook object
        Workbook workbook = new Workbook(path);
  

        //Get the first worksheet in the workbook
        Worksheet worksheet = workbook.Worksheets[0];

        //Get the cells collection in the sheet
        Cells cells = worksheet.Cells;

        //Put a string value into the cell using its name
        cells["A1"].PutValue("Cell Value");

        //put a string value into the cell using its name
        cells["A2"].PutValue("Hello World");
        ////Save file and send to client browser using selected format
       workbook.Save(HttpContext.Current.Response, "HelloWorld.xls", ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
 
        //end response to avoid unneeded html
        HttpContext.Current.Response.End();      

相关文章:

  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-08-08
  • 2021-09-24
  • 2021-07-22
  • 2021-08-30
  • 2021-08-14
猜你喜欢
  • 2022-02-05
  • 2021-12-13
  • 2021-06-27
  • 2022-01-25
  • 2021-12-22
  • 2021-09-23
  • 2022-01-02
相关资源
相似解决方案