Hi
I have a problem with poor performance when using ImportArray or PutValue in large spreadsheets. Some sample code is below:
int [] taker = new int [60];
int [] questions = new int [60];
int [] answers = new int [60];
foreach (int takerID in
surveyCol.Keys)
{
if (curRow % 2
== 0)
{
cells.Rows [curRow].Style.ForegroundColor = colours
[4];
}
SurveyTaker
takerTmp = (SurveyTaker)surveyCol [takerID];
if
(takerTmp.Demographics.ContainsValue (Convert.ToInt32 (dr [“id”])))
{
for (int i = 0; i < 60; i++)<br>
{<br>
taker <img src="/community/emoticons/emotion-55.gif" alt="Idea [I]" /> = takerID;<br>
questions <img src="/community/emoticons/emotion-55.gif" alt="Idea [I]" /> = i + 1;<br>
}<br>
foreach (int stockQuestionID in
takerTmp.StockAnswers.Keys)
{<br>
answers [stockQuestionID - 1] =
(int)takerTmp.StockAnswers [stockQuestionID];
}<br>
cells.ImportArray (taker, curRow, curColumn, true);<br>
cells.ImportArray (questions, curRow,
(byte)(curColumn + 1), true);
cells.ImportArray (answers, curRow, (byte)(curColumn
-
2), true);
curRow += 60;
}
}
If I comment out the curRow += 60 line, just after the three
ImportArray calls, then the performance is blazingly quick, which leads
me to believe that it is the allocating of space for all the cells that
is slowing everything down. But it seems to slow down exponentially as
the number of cells go up. I have 512 mb of ram in this machine. Would
that be a problem? The spreadsheet in question has about 30000 rows,
and about 70 columns, and takes about 15 minutes to generate. Is this
normal for a spreadsheet of this size? I’m using the latest version of
Aspose.Excel.
Thanks
Andrew