From 6962323c2ec1c4246ff6c2b388eefbe04cdc4fc3 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 13 Jun 2012 07:21:00 +0000 Subject: [PATCH] fpspreadsheet: OpenDocument: Adds support for word-wrap formatting option and fixes the styles setting for numeric cells git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2463 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpsopendocument.pas | 19 ++++++++++++++++--- components/fpspreadsheet/fpspreadsheet.pas | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/components/fpspreadsheet/fpsopendocument.pas b/components/fpspreadsheet/fpsopendocument.pas index c91ae8b45..9bf4df894 100755 --- a/components/fpspreadsheet/fpsopendocument.pas +++ b/components/fpspreadsheet/fpsopendocument.pas @@ -497,12 +497,16 @@ begin ' ' + LineEnding; // Fields + + // style:text-properties if uffBold in FFormattingStyles[i].UsedFormattingFields then Result := Result + ' ' + LineEnding; + // style:table-cell-properties if (uffBorder in FFormattingStyles[i].UsedFormattingFields) or - (uffBackgroundColor in FFormattingStyles[i].UsedFormattingFields) then + (uffBackgroundColor in FFormattingStyles[i].UsedFormattingFields) or + (uffWordWrap in FFormattingStyles[i].UsedFormattingFields) then begin Result := Result + ' ' + LineEnding; end; @@ -660,9 +669,13 @@ var StrValue: string; DisplayStr: string; lStyle: string = ''; + lIndex: Integer; begin - if uffBold in ACell^.UsedFormattingFields then - lStyle := ' table:style-name="bold" '; + if ACell^.UsedFormattingFields <> [] then + begin + lIndex := FindFormattingInList(ACell); + lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" '; + end; // The row should already be the correct one if IsInfinite(AValue) then begin diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index e1dbdfe7d..91f8a150c 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -89,7 +89,8 @@ type {@@ List of possible formatting fields } - TsUsedFormattingField = (uffTextRotation, uffBold, uffBorder, uffBackgroundColor); + TsUsedFormattingField = (uffTextRotation, uffBold, uffBorder, uffBackgroundColor, + uffWordWrap); {@@ Describes which formatting fields are active }