anchor.diff:        while not FDBGrid.DataSource.DataSet.EOF do
         begin
           col := 0;
  -        for i := 0 to tmpFields.Count - 1 do
  +
  +        for i := 0 to FDBGrid.Columns.Count - 1 do
  +        begin
  +          if FDBGrid.Columns.Items[i].Visible then
  +          begin
  +            tmpField := FDBGrid.Columns.Items[i].Field;
  +            if not tmpField.IsNull then
  +            begin
  +              if (tmpField.DataType = ftSmallint) or (tmpField.DataType = ftInteger) or (tmpField.DataType = ftLargeint) then
  +                MyWorksheet.WriteNumber(row, col, tmpField.AsFloat, nfGeneral, 0)
  +              else
  +              if (tmpField.DataType = ftFloat) then
  +                MyWorksheet.WriteNumber(row, col, tmpField.AsFloat)
  +              else
  +              if (tmpField.DataType = ftDate) or (tmpField.DataType = ftDateTime) or (tmpField.DataType = ftTime) or (tmpField.DataType = ftTimeStamp) then
  +                MyWorksheet.WriteDateTime(row, col, tmpField.AsDateTime)
  +              else
  +              if (tmpField.DataType = ftBoolean) then
  +                MyWorksheet.WriteBoolValue(row, col, tmpField.AsBoolean)
  +              else
  +                MyWorksheet.WriteText(row, col, tmpField.AsString);
  +            end;
  +            inc(col);
  +          end;
  +        end;
  +(*        for i := 0 to tmpFields.Count - 1 do
           begin
             if tmpFields[i].Visible then
             begin
  
positive.code:   MyWorksheet : TsWorksheet;
    tmpFields : TFields;
    i, rn, row, col : integer;
  begin
    MyWorkbook := TsWorkbook.Create;
    try
  
negative.code:             end;
              inc(col);
            end;
          end;*)
  
          inc(row);
          FDBGrid.DataSource.DataSet.Next;
  