Insert Block of rows - veeeery slow

Hello,

My app is using a function to insert a block of lines, but it is very slow when the number of lines is high (the time increases exponentially). I hope that you create a function to insert a block of lines automatically, not one by one.

This is my function:


protected void btn_Insert_Click(object sender, EventArgs e)

{

ArrayList fields = new ArrayList();

fields = stringtoarray((string)Session["fields"]);

int columns = fields.Count; // retrieve the number of columns inside the the grid (there is a ASPOSE way to know?)

int active_ss = (int)Session["SheetIndex"];

WebWorksheet sheet = GridWeb1.WebWorksheets[active_ss];

WebCells cells = GridWeb1.WebWorksheets[active_ss].Cells;

int num_lines = Convert.ToInt16(InsertNumber.Text); // number of lines to insert in the spreadsheet

int counter = 0;

int origin = 0;

int line = 1; // line to copy validation from (first line with data - 0 is header)

if (GridWeb1.ActiveCell != null)

line = GridWeb1.ActiveCell.Row; // retrieve the number of the line selected, if none selected starting line = 1

if (line == 1)

origin = 2; // if the line selected is the first with data, the validation will come from the 2nd line

while (num_lines > counter)

{

sheet.Cells.InsertRow(line); // insert 1 line at position (line)

for (int col = 0; col <= columns; col++) // for each cell, copy the validation data from row "origin"

cells[line, col].Validation = cells[origin, col].Validation;

counter++; // increases the number of lines copied, until (counter > num_lines)

}

InsertNumber.Text = ""; // clear the textbox with the number of lines inserted

}


Thanks in advance,

Rudolf Gütlich
Delsis Eng.

Hi,

Thank you for point this issue out. We will improve the insert feature in the future version.