Welcome, Guest
Username: Password: Remember me
Components and Libraries for Documents Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Correction unit fpsexport 8 years 3 months ago #9240

  • Randall G. Garcia C
  • Randall G. Garcia C's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
Hi there
Here I attached a procedure that must be corrected in the fpsexport unit because the currency float and puts a symbol fields below
procedure TCustomFPSExport.ExportField(EF: TExportFieldItem);
var
  F : TFPSExportFieldItem;
  dt: TDateTime;
begin
  F := EF as TFPSExportFieldItem;
  with F do
  begin
    // Export depending on field datatype;
    // Fall back to string if unknown datatype
    If Field.IsNull then
      FSheet.WriteBlank(FRow, EF.Index)
    else if Field.Datatype in (IntFieldTypes+[ftAutoInc,ftLargeInt]) then
      FSheet.WriteNumber(FRow, EF.Index,Field.AsInteger)
    else if Field.Datatype=ftCurrency then
      FSheet.WriteCurrency(FRow, EF.Index, Field.AsFloat)
    else if Field.Datatype in [ftBCD,ftFloat,ftFMTBcd] then
      FSheet.WriteNumber(FRow, EF.Index, Field.AsFloat)
    else if Field.DataType in [ftString,ftFixedChar] then
      FSheet.WriteText(FRow, EF.Index, Field.AsString)
    else if (Field.DataType in ([ftWideMemo,ftWideString,ftFixedWideChar]+BlobFieldTypes)) then
      FSheet.WriteText(FRow, EF.Index, UTF8Encode(Field.AsWideString))
      { Note: we test for the wide text fields before the MemoFieldTypes, in order to
      let ftWideMemo end up at the right place }
    else if Field.DataType in MemoFieldTypes then
      FSheet.WriteText(FRow, EF.Index, Field.AsString)
    else if Field.DataType=ftBoolean then
      FSheet.WriteBoolValue(FRow, EF.Index, Field.AsBoolean)
    else if Field.DataType in DateFieldTypes then
      case Field.DataType of
        ftDate: FSheet.WriteDateTime(FRow, EF.Index, Field.AsDateTime, nfShortDate);
        ftTime: FSheet.WriteDateTime(FRow, EF.Index, Field.AsDatetime, nfLongTime);
        else    // try to guess best format if Field.DataType is ftDateTime
                dt := Field.AsDateTime;
                if dt < 1.0 then
                  FSheet.WriteDateTime(FRow, EF.Index, Field.AsDateTime, nfLongTime)
                else if frac(dt) = 0 then
                  FSheet.WriteDateTime(FRow, EF.Index, Field.AsDateTime, nfShortDate)
                else
                  FSheet.WriteDateTime(FRow, EF.Index, Field.AsDateTime, nfShortDateTime);
      end
    else //fallback to string
      FSheet.WriteText(FRow, EF.Index, Field.AsString);
  end;
end;

these are the lines corrected
    else if Field.Datatype=ftCurrency then
      FSheet.WriteCurrency(FRow, EF.Index, Field.AsFloat)
    else if Field.Datatype in [ftBCD,ftFloat,ftFMTBcd] then
      FSheet.WriteNumber(FRow, EF.Index, Field.AsFloat)

Please Log in or Create an account to join the conversation.

Correction unit fpsexport 8 years 3 months ago #9241

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4519
  • Thank you received: 1102
Thanks Sir
we will update and test
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1