anchor.diff:  var
     I, J, Min, Max, N, Span, Addon, Distributable, TotalPC, Accum,
       ExcessMin, ExcessMax, NonPC, PCWidth, NewTotalPC: Integer;
  -  More: boolean;
     Cells: TCellList;
     CellObj: TCellObj;
  +  MaxSpans: array of Integer;
  +  MaxSpan: Integer;
   begin
   {Find the max and min widths of each column}
     for I := 0 to NumCols - 1 do
  
positive.code:                 end;
                end;
              end
              else if ColSpan > Span then
                More := True {set if need another iteration}
            end;
        end;
      end;
      Inc(Span);
    end;
  
    TotalMaxWidth := 0; TotalMinWidth := 0;
    for I := 0 to NumCols - 1 do
    begin
      Inc(TotalMaxWidth, MaxWidths[I]);
  
negative.code:     MinWidths[I] := 0;
      Percents[I] := 0;
    end;
  
    SetLength(Heights, 0);
    Span := 1;
  
    //BG, 29.01.2011: data for loop termination and to speed up looping through
    //  very large tables with large spans.
    //  A table with 77 rows and 265 columns and a MaxSpan of 265 in 2 rows
    //  was processed in 3 seconds before the tuning and 80ms afterwards.
    MaxSpan := 1;
    SetLength(MaxSpans, Rows.Count);
    for J := 0 to Rows.Count - 1 do
      MaxSpans[J] := 1;
    repeat
      for J := 0 to Rows.Count - 1 do
      begin
        //BG, 29.01.2011: tuning: process rows only, if there is at least 1 cell to process left.
        if Span > MaxSpans[J] then
          continue;
        Cells := Rows[J];
        //BG, 29.01.2011: tuning: process up to cells only, if there is at least 1 cell to process left.
        for I := 0 to Cells.Count - Span do
        begin
          CellObj := Cells[I];
          if CellObj <> nil then
            if CellObj.ColSpan = Span then
              with CellObj do
              begin
                PCWidth := 0;
                if CellObj.WidthAttr > 0 then
                  if CellObj.AsPercent then
                    PCWidth := CellObj.WidthAttr
                  else if TheWidth > 0 then
                    PCWidth := Math.Min(1000, MulDiv(WidthAttr, 1000, TheWidth));
  
  