C# - Fill a .xlsx / .xls - file with data based on a grid
-
Hey, I have my data in a grid (no datagridview), export a grid (30 cols and over 20.000 rows) takes a lot of time (minimum 2minutes)... X| now my question: Is there a way to accelerate this?
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}Thank you
-
Hey, I have my data in a grid (no datagridview), export a grid (30 cols and over 20.000 rows) takes a lot of time (minimum 2minutes)... X| now my question: Is there a way to accelerate this?
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}Thank you
Hi Might be worth looking in to the Range.set_value method. I've used the get_value method to import a whole sheet in to an array so you should be able to do the reverse easily enough. There is an example here http://stackoverflow.com/questions/2314393/how-to-specify-format-for-individual-cells-with-excel-range-set-value[^]
The FoZ
-
Hey, I have my data in a grid (no datagridview), export a grid (30 cols and over 20.000 rows) takes a lot of time (minimum 2minutes)... X| now my question: Is there a way to accelerate this?
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}Thank you
Why can't you use Response.write with Inline or attachment file type to export data from Grid to Excel.
Rashmi.M.K
-
Hey, I have my data in a grid (no datagridview), export a grid (30 cols and over 20.000 rows) takes a lot of time (minimum 2minutes)... X| now my question: Is there a way to accelerate this?
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}Thank you
Check this article. It is fast.