Hello,
I have got a problem when creating a second sheet with the AdvGridWorkbook:
My first sheet is quite large (about 500 columns and 5000 rows). Creating this one works perfectly fine. However, when creating a second worksheet which is to be quite small (about 2 columns and 20 rows), the program is busy for quite some time.
When looking
at the resource monitor I recognized that my program is allocating as much
memory as previously for the first work sheet (about 150mb). It
seems like the memory allocation occurs when setting
'AdvGridWorkbook.ActiveSheet'. There is a code example following.
Is there a possibility of setting the default size of a new sheet before setting the active sheet?
I am running the TMS Component Pack at version 8.3.4.0_2016_09_23.
Thank you in advance
Niklas Schelten
startTime := MillisecondOfTheDay(Now);
ASGWB.ActiveSheet := 0;
ASGWB.Grid.BeginUpdate;
Try
ASGWB.Grid.ColCount := 500;
ASGWB.Grid.RowCount := 5000;
for i_R := 0 to ASGWB.Grid.RowCount -1 do
begin
for i_C := 0 to ASGWB.Grid.ColCount - 1 do
begin
if i_R = 0 then
ASGWB.Grid.Cells[i_C, i_R] := inttostr(i_C)
else
ASGWB.Grid.Cells[i_C, i_R] := inttostr(i_C) + '/' + inttostr(i_R);
if i_R = i_C then
ASGWB.Grid.Colors[i_C, i_R] := clGreen;
end;
end;
Finally
ASGWB.Grid.EndUpdate;
End;
ShowMessage(IntToStr(MillisecondOfTheDay(Now)-startTime));// until here it takes about 500ms
startTime := MillisecondOfTheDay(Now);
ASGWB.ActiveSheet := 1;
ShowMessage(IntToStr(MillisecondOfTheDay(Now)-startTime));// this outputs something about 18000ms
<!--if gte mso 9>
<w:Word>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:Trackatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfInvalid>false</w:SaveIfInvalid>
<w:IgnoreMixed>false</w:IgnoreMixed>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DonotPromoteQF/>
<w:LidThemeOther>DE</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplex>X-NONE</w:LidThemeComplex>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndark/>
<w:EnableKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:Word>