fpspreadsheet: Fix "FitToCell" method of TsWorksheetGrid to be active only with nfGeneral-formatted numbers.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3930 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-02-05 18:06:52 +00:00
parent e90222405a
commit c896fa3733

View File

@ -3487,13 +3487,15 @@ var
isRotated: Boolean; isRotated: Boolean;
isStacked: Boolean; isStacked: Boolean;
tr: TsTextRotation; tr: TsTextRotation;
fmt: PsCellFormat;
begin begin
Result := Worksheet.ReadAsUTF8Text(ACell); Result := Worksheet.ReadAsUTF8Text(ACell);
if (Result = '') or ((ACell <> nil) and (ACell^.ContentType = cctUTF8String)) if (Result = '') or ((ACell <> nil) and (ACell^.ContentType = cctUTF8String))
then then
exit; exit;
tr := Worksheet.ReadTextRotation(ACell); fmt := Workbook.GetPointerToCellFormat(ACell^.FormatIndex);
tr := fmt^.TextRotation;
isRotated := (tr <> trHorizontal); isRotated := (tr <> trHorizontal);
isStacked := (tr = rtStacked); isStacked := (tr = rtStacked);
// isRotated := (uffTextRotation in ACell^.UsedFormattingFields) and (ACell^.TextRotation <> trHorizontal); // isRotated := (uffTextRotation in ACell^.UsedFormattingFields) and (ACell^.TextRotation <> trHorizontal);
@ -3515,7 +3517,7 @@ begin
if txtSize <= cellSize then if txtSize <= cellSize then
exit; exit;
if (ACell^.ContentType = cctNumber) then if (ACell^.ContentType = cctNumber) and (fmt^.NumberFormat = nfGeneral) then
begin begin
// Determine number of decimal places // Determine number of decimal places
p := pos(Workbook.FormatSettings.DecimalSeparator, Result); p := pos(Workbook.FormatSettings.DecimalSeparator, Result);