【问题标题】:Multiple Excel Sheets in One Excel File一个 Excel 文件中的多个 Excel 工作表
【发布时间】:2018-04-09 21:15:37
【问题描述】:

我想在 xlWorkbook 中创建 4 张工作表;

     private void btnExportExcel_Click(object sender, EventArgs e)
           {           
           Excel.Application xlApp;
           Excel.Workbook  xlWorkbook;
           Excel.Worksheet xlWorkSheet;
           xlWorkSheet = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(1);
                  // Code Logic 
           }

我试过了

          Excel.Worksheet xlWorkSheet2;
          xlWorkSheet2 = (Excel.Worksheet)xlWorkbook.Worksheets.get_Item(2);

但没有成功。谁能帮帮我

【问题讨论】:

    标签: c# excel forms window


    【解决方案1】:

    我从here 得到这个:

    Excel.Worksheet xlWorkSheet2;
    xlWorkSheet2 = (Excel.Worksheet)xlWorkbook.Worksheets.Add();
    

    这样做四次,你会得到 4 张。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 1970-01-01
      • 2022-12-13
      • 2023-03-30
      相关资源
      最近更新 更多