Hello!
I use this code for exporting data from firebird db to xls worksheet (a part of code)
MyDatabase.DisableControls;
MyDatabase.First;
j := 2;
while not MyDatabase.EOF do begin
for i:=0 to MyDatabase.Fields.Count-1 do begin
if MyDatabase.Fields[i].DataType in [ftDateTime, ftDate, ftTime, ftTimeStamp] then
// MyWorksheet.WriteDateTime(j, i, MyDatabase.Fields[i].AsDateTime)
MyWorksheet.WriteUTF8Text(j, i, DateTimeToStr(MyDatabase.Fields[i].AsDateTime))
else if MyDatabase.Fields[i].DataType in [ftInteger, ftSmallint, ftLargeint, ftAutoInc, ftWord, ftBoolean] then
MyWorksheet.WriteNumber(j, i, MyDatabase.Fields[i].AsInteger)
else if MyDatabase.Fields[i].DataType in [ftFloat, ftCurrency] then
MyWorksheet.WriteNumber(j, i, RoundN(MyDatabase.Fields[i].AsFloat, 2))
// else if MyDatabase.Fields[i].DataType <> ftBlob then
else if MyDatabase.Fields[i].DataType in [ftString] then begin
// s := RemoveBracket( MyDatabase.Fields[i].AsString );
s := MyDatabase.Fields[i].AsString;
MyWorksheet.WriteUTF8Text(j, i, s);
{
MyWorksheet.WriteUTF8Text(j, i, MyDatabase.Fields[i].AsString);
}
end;
end;
MyDatabase.Next;
Inc(j);
end;
I noticed that data is exported until it didn't find <brak> value.
When this value is found export stops. Next fields are not exported.
When I process the string value by a procedure RemoveBracket.
s := RemoveBracket( MyDatabase.Fields[i].AsString );
Which simply replaces <brak> with empty string '' all data is exported corecty.
Is it a bug or < > are restricted signs for spreadsheet in text field?
Is there any workaround to fix it?