想实现从一个excel文件的一张表拷贝至另一个excle文件的一张表,想利用sperad控件来做,但是发现打开和保存非常慢。请问有没有好的办法?主要代码 如下: string excel1 = "D:\\11.xlsx";
string excel2 = "D:\\22.xlsx";
FpSpread fp1 = new FpSpread();
FpSpread fp2 = new FpSpread();
fp1.OpenExcel(excel1);
fp2.OpenExcel(excel2);
SheetView sheet1 = fp1.Sheets["洞身输入表"];
SheetView sheet2 = fp2.Sheets["洞身输入表"];
int row = sheet1.NonEmptyRowCount;
int col = sheet1.NonEmptyColumnCount;
for (int ro = 0; ro < row; ro++)
{
for (int co = 0; co < col; co++)
{
if (sheet1.Cells[ro, co].Formula == string.Empty)
{
//公式不为空,即:没有公式,要复制内容
//sheet2.Cells[ro, co].Value = sheet1.Cells[ro, co].Value;
sheet2.Cells[ro, co].Text = sheet1.Cells[ro, co].Text;
}
}
}
fp2.SaveExcel(excel2, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);
|
|