From c896fa37337c422fc64cad80a5e390e72211c275 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Thu, 5 Feb 2015 18:06:52 +0000 Subject: [PATCH] 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 --- components/fpspreadsheet/fpspreadsheetgrid.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index 6ef24feed..3501b556d 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -3487,13 +3487,15 @@ var isRotated: Boolean; isStacked: Boolean; tr: TsTextRotation; + fmt: PsCellFormat; begin Result := Worksheet.ReadAsUTF8Text(ACell); if (Result = '') or ((ACell <> nil) and (ACell^.ContentType = cctUTF8String)) then exit; - tr := Worksheet.ReadTextRotation(ACell); + fmt := Workbook.GetPointerToCellFormat(ACell^.FormatIndex); + tr := fmt^.TextRotation; isRotated := (tr <> trHorizontal); isStacked := (tr = rtStacked); // isRotated := (uffTextRotation in ACell^.UsedFormattingFields) and (ACell^.TextRotation <> trHorizontal); @@ -3515,7 +3517,7 @@ begin if txtSize <= cellSize then exit; - if (ACell^.ContentType = cctNumber) then + if (ACell^.ContentType = cctNumber) and (fmt^.NumberFormat = nfGeneral) then begin // Determine number of decimal places p := pos(Workbook.FormatSettings.DecimalSeparator, Result);