网上很多写法都会覆盖原有sheet 所以自己写了一个 不会覆盖的
using BDX_SW_TestDataExportSoftware.Common;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using OfficeOpenXml;
namespace BROADEX_DB_TOOL
{
class NPOIHelper
{
public static bool DataTableToExcelSheets(DataTable dt, string SheetsName)
{
bool result = false;
FileStream fs = null;
IRow row = null;
ICell cell = null;
//上一篇教程中生成的文件
string tempPath = Shared_body.txtPath;
HSSFWorkbook wk = null;
using (fs = File.Open(tempPath, FileMode.Open,FileAccess.Read, FileShare.ReadWrite))
{
//把xls文件读入work