1) Creating XLS with current regional settings, but not 1200 codepage
procedure TRecordStorageGlobals.SetDefaultData;
begin
.....
{$IFDEF VVC}
PCODEPAGE := AddDefRecWord(BIFFRECID_CODEPAGE, GetACP());
{$ELSE}
PCODEPAGE := AddDefRecWord(BIFFRECID_CODEPAGE,$04B0);
{$ENDIF}
......
2) Bad data when writing unicode non english strings.
procedure TXLSReadII.RREC_LABEL;
var
i: integer;
P: PWordArray;
WS: WideString;
begin
InsertRecord := False;
with PRecLABEL(PBuf)^ do begin
if FXLS.Version > xvExcel97 then
FXLS.Sheets[FCurrSheet].IntWriteSSTString(Col,Row,FormatIndex,ByteStrToWideString(@Data[0],Len))
else begin
SetLength(WS,Len);
if Data[0] = 0 then begin
{$IFDEF VVC}
MultiByteToWideChar(FXLS.CodePage,MB_PRECOMPOSED,Pointer(Integer(@Data)+1),Len-1,PWideChar(WS),Len*2);
{$ELSE}
for i := 1 to Len do
WS := WideChar(Data);
{$ENDIF}
end
else if Data[0] = 1 then begin
P := @Data[1];
for i := 0 to Len - 1 do
WS[i + 1] := WideChar(P);
end
else begin
{$IFDEF VVC}
MultiByteToWideChar(FXLS.CodePage,MB_PRECOMPOSED,@Data,Len,PWideChar(WS),Len*2);
{$ELSE}
for i := 0 to Len - 1 do
WS[i + 1] := WideChar(Data);
{$ENDIF}
end;
FXLS.Sheets[FCurrSheet].IntWriteSSTString(Col,Row,FormatIndex,WS);
end;
end;
end;
may be small mistakes? in XLS RW 3 (My fixes below)
Hello
Sorry, but your changes are completly wrong. Do not use them.
Excel uses unicode strings in order to display non-latin characters. What you shall do is to assign a correct unicode string to the cell with the AsString property. If you have done so, and your characters don't shows correct in excel, the problem is probably that there is no font installed that can handle the characters.
Lars Arvidsson
Sorry, but your changes are completly wrong. Do not use them.
Excel uses unicode strings in order to display non-latin characters. What you shall do is to assign a correct unicode string to the cell with the AsString property. If you have done so, and your characters don't shows correct in excel, the problem is probably that there is no font installed that can handle the characters.
Lars Arvidsson
Another yet
In source
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E,$14];
end;
may must be?
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E..$14];
end;
or even
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E..$16];
end;
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E,$14];
end;
may must be?
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E..$14];
end;
or even
function TCellFormat.FormatIsDateTime: boolean;
begin
Result := FXF.NumFmtIndex in [$0E..$16];
end;