本文整理汇总了C#中Common.System.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# System.Clone方法的具体用法?C# System.Clone怎么用?C# System.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.System
的用法示例。
在下文中一共展示了System.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Export
public void Export(int sheetIndex, int rowIndexStart, int columnIndexStart, System.Data.DataTable dtExport, bool isAddTitle)
{
Worksheet sheet = GetSheet(sheetIndex);
System.Data.DataTable dtExportPage = dtExport.Clone();
string[,] arrExportPage = null;
Range range = null;
int dataColumnCount = dtExport.Columns.Count;
if (isAddTitle)
{
arrExportPage = new string[1, dataColumnCount];
for (int indexColumn = 0; indexColumn < dataColumnCount; indexColumn++)
{
arrExportPage[0, indexColumn] = dtExport.Columns[indexColumn].ColumnName;
}
range = GetRange(sheet, rowIndexStart, columnIndexStart, rowIndexStart, columnIndexStart + dataColumnCount - 1);
range.Value2 = arrExportPage;
range.Value2 = range.Value2;
rowIndexStart++;
}
int pageSize = 10000;
int currentDataRowIndex = 0;
while (currentDataRowIndex < dtExport.Rows.Count)
{
dtExportPage.Rows.Add(dtExport.Rows[currentDataRowIndex].ItemArray);
if ((currentDataRowIndex + 1) % pageSize == 0)
{
arrExportPage = Tools.DataTableToArray(dtExportPage, false);
range = GetRange(sheet, rowIndexStart, columnIndexStart, rowIndexStart + dtExportPage.Rows.Count - 1, columnIndexStart + dataColumnCount - 1);
range.Value2 = arrExportPage;
range.Value2 = range.Value2;
rowIndexStart += dtExportPage.Rows.Count;
dtExportPage.Rows.Clear();
}
currentDataRowIndex++;
}
//ʣ�����ȡ������
arrExportPage = Tools.DataTableToArray(dtExportPage, false);
range = GetRange(sheet, rowIndexStart, columnIndexStart, rowIndexStart + dtExportPage.Rows.Count - 1, columnIndexStart + dataColumnCount - 1);
range.Value2 = arrExportPage;
range.Value2 = range.Value2;
dtExportPage.Rows.Clear();
}