我有代码如下:
int curRow=accBookPrintColsInfo.iStartRow;
foreach (DataRow dr in drs)
{
if (oSheet.RowCount <= curRow)
{
oSheet.RowCount++;
}
oSheet.CopyRange(accBookPrintColsInfo.iStartRow, 0, curRow, 0, 1, oSheet.ColumnCount, false);//因为accBookPrintColsInfo.iStartRow行有用户设置的样式,所以必须拷贝
if (accBookPrintInfo.UseTemplateParams == 0)
oSheet.SetRowHeight(curRow, (int)CM2Pixels((decimal)accBookPrintInfo.RowHeight));
else
oSheet.SetRowHeight(curRow, oSheet.GetRowHeight(accBookPrintColsInfo.iStartRow));
//以下为填写数据,如:
oSheet.Cells[curRow, accBookPrintColsInfo.iDayCol].Value =****
....................
curRow++;
}
我用过度条测试过,感觉是1秒左右才能填写一条数据,请问为什么?如果我把写数据的行全引了,整过循环几秒就完了。 |
|