anchor.diff:        else
         begin
           // add the remaining pixels to the first column's width.
  -        Inc(Widths[I], Required - AddedExcess);
  +        Inc(Widths[I], Excess - AddedExcess);
           break;
         end;
   end;
  
positive.code:       end;
      end;
  
    var
      Specified: boolean;
      NewWidth, MaxWidth, MinWidth, D, W, I: Integer;
      Counts: TIntegerPerWidthType;
      wt: TWidthType;
    begin
      Specified := tblWidthAttr > 0;
      if Specified then
  
negative.code:     begin
        // Table fits into NewWidth.
  
        Counts[wtPercent] := 0;
        PercentAbove0Count := 0;
        for I := 0 to NumCols - 1 do
          if ColumnSpecs[I] = wtPercent then
          begin
            Inc(Counts[wtPercent]);
            if Percents[I] > 0 then
              Inc(PercentAbove0Count);
          end;
  
        Widths := Copy(MinWidths);
        if (PercentAbove0Count > 0) and (NewWidth > 0) then
        begin
          // Calculate widths with respect to percentage specifications.
          // Don't shrink Column i below MinWidth[i]! Therefor spread exessive space
          // trying to fit the percentage demands.
          // If there are more than 100% percent reduce linearly to 100% (including
          // the corresponding percentages of the MinWidth of all other columns).
          SetLength(PercentDeltas, NumCols);
          CalcPercentDeltas(PercentDeltas, NewWidth);
  
          PercentDeltaAbove0Count := 0;
          for I := 0 to NumCols - 1 do
            if PercentDeltas[I] > 0 then
              Inc(PercentDeltaAbove0Count);
  
  
          IncreaseWidthsByPercentage(Widths, PercentDeltas, 0, NumCols - 1, NewWidth, MinWidth, Sum(PercentDeltas), PercentDeltaAbove0Count);
        end;
        MinWidth := Sum(Widths);
  
  