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
This commit is contained in:
sekelsenmat
2012-06-13 07:21:00 +00:00
parent e4f415e21d
commit 6962323c2e
2 changed files with 18 additions and 4 deletions

View File

@ -497,12 +497,16 @@ begin
' <style:style style:name="ce' + IntToStr(i) + '" style:family="table-cell" style:parent-style-name="Default">' + LineEnding;
// Fields
// style:text-properties
if uffBold in FFormattingStyles[i].UsedFormattingFields then
Result := Result +
' <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>' + 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 + ' <style:table-cell-properties ';
@ -527,6 +531,11 @@ begin
+ FPSColorToHexString(FFormattingStyles[i].BackgroundColor) +'" ';
end;
if (uffWordWrap in FFormattingStyles[i].UsedFormattingFields) then
begin
Result := Result + 'fo:wrap-option="wrap" ';
end;
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

View File

@ -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 }