Excel: Not enough storage available... when using AddIn Express code

Add-in Express™ Support Service
That's what is more important than anything else

Excel: Not enough storage available... when using AddIn Express code
 
George Spears




Posts: 70
Joined: 2010-05-06
Hello,
Win 10, Excel 2013, 32 bit. I have a spreadsheet, with 75000 rows, of approx 28MB in size.
I have a single Delphi routine. Loop through all rows, and for a single column, read the column, do some string processing (basically making it HTML formatted), and write it back to the same location.

The code seems to work fine, but almost immediately gives me an error when running "Not enough storage is available to complete this operation." The machine I am running on has 32GB of RAM, and task manager shows memory usage does not go above 12%.

I have plenty of space on my hard drives as well.
This happens predictably, and consistently. Rebooting and immediately running this process makes no difference. This is being run OUTSIDE of Delphi, aka Delphi XE6 is NOT running.

Out of the approx 75,000 rows, only 9,000 or so have ANY data in this column, but the data is long, between 1500 and 12000 chars.

Here is most of my code...


...
SL := TStringList.Create;

  for i := StartingRow to BoundRec.LastRow do
  begin
    // Make sure that there is NOT a filter applied.
    if IsRowVisible(i) then
    begin

     CellAddr := ColumnToUpdate + IntToStr(i);
     // Read the cell contents, which is a multiline string, separated by CR/LF pairs
     MyCellText := Trim(aws.Range[CellAddr, EmptyParam].Value);

      if Length(MyCellText) > 0 then
      begin
        // There is something here...
       SL.Clear;
       SL.Text := MyCellText;

       // Now HTML format the cells contents, which is in the format CATEGORY, then contents, then CATEGORY...
       // Make each CATEGORY HTML Formatted BOLD
       for x  :=  1 to SL.Count  do
        begin
          if Odd(x)  then
          ThisLine := '[b]' + Trim(SL[x-1]) + '[/b]<br>'
          else
          ThisLine :=  Trim(SL[x-1]) + '<br>';

          FinalLine := FinalLine + ThisLine;
        end;

        // Now write the data back...
        if chkAddQuotes.Checked then
        aws.Range[CellAddr, EmptyParam].Value := QuotedStr(FinalLine)
        else
        aws.Range[CellAddr, EmptyParam].Value := FinalLine;


      end;
    end;
  end;
  SL.Free;


Any help appreciated.

Thanks
/gs
Posted 04 Dec, 2015 15:35:32 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hello George,

We would need to have a sample project reproducing this. We suppose there are some memory leaks not reflected in the code you supplied. You can send us such a project to the support email address, see readme.txt.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Dec, 2015 06:55:13 Top