Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用FpSread.SaveExcel将多个网格数据保存到同一excel文件的多个工作表中_Excel_Vb.net - Fatal编程技术网

如何使用FpSread.SaveExcel将多个网格数据保存到同一excel文件的多个工作表中

如何使用FpSread.SaveExcel将多个网格数据保存到同一excel文件的多个工作表中,excel,vb.net,Excel,Vb.net,这就是我迄今为止所尝试的 If SaveExcel.ShowDialog = Windows.Forms.DialogResult.OK Then gridCli.SaveExcel(SaveExcel.FileName,"Clients" FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat Or FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders) gr

这就是我迄今为止所尝试的

If SaveExcel.ShowDialog = Windows.Forms.DialogResult.OK Then
            gridCli.SaveExcel(SaveExcel.FileName,"Clients" FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat Or FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders)
            gridFin_Trans.SaveExcel(SaveExcel.FileName,"Financials" FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat Or FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders)
            portfolioGrid.SaveExcel(SaveExcel.FileName,"Sheet3" FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat Or FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders)

End If
在这里,我要告诉大家哪里出了问题:

从评论中:


要将工作表保存到同一Excel工作簿,需要将工作表添加到
FpSpread
的一个实例中,然后使用SaveExcel保存该实例

  • 创建一个新的FpSpread
  • 使用
    FpSpread.sheets.Add
    将这些图纸添加到其中
  • 然后调用*
    FpSpread.SaveExcel
    *

要将工作表保存到同一个Excel工作簿中,您需要将工作表添加到FpSpread的一个实例中,然后使用SaveExcel保存该实例。创建新的FpSpread,使用FpSpread.sheets.Add将这些图纸添加到其中,然后调用FpSpread.SaveExcel