fpspreadsheet: Avoid writing duplicate code for fixed and conditional formats to ODS file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7515 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-07-01 21:16:53 +00:00
parent c22cdde14b
commit 28e834c330
3 changed files with 136 additions and 185 deletions

View File

@ -10,7 +10,6 @@ var
sh: TsWorksheet; sh: TsWorksheet;
fmt: TsCellFormat; fmt: TsCellFormat;
fmtIdx: Integer; fmtIdx: Integer;
font: TsFont;
row: Integer; row: Integer;
i: Integer; i: Integer;
lastCol: Integer; lastCol: Integer;

View File

@ -193,12 +193,10 @@ type
procedure WriteAutomaticStyles(AStream: TStream); procedure WriteAutomaticStyles(AStream: TStream);
procedure WriteCellRow(AStream: TStream; ASheet: TsBasicWorksheet; procedure WriteCellRow(AStream: TStream; ASheet: TsBasicWorksheet;
ARowIndex, ALastColIndex: Integer); ARowIndex, ALastColIndex: Integer);
procedure WriteCellStyle(AStream: TStream; AFormatIndex, AConditionalFormatIndex: integer);
procedure WriteCellStyles(AStream: TStream); procedure WriteCellStyles(AStream: TStream);
procedure WriteColStyles(AStream: TStream); procedure WriteColStyles(AStream: TStream);
procedure WriteColumns(AStream: TStream; ASheet: TsBasicWorksheet); procedure WriteColumns(AStream: TStream; ASheet: TsBasicWorksheet);
procedure WriteConditionalFormats(AStream: TStream; ASheet: TsBasicWorksheet); procedure WriteConditionalFormats(AStream: TStream; ASheet: TsBasicWorksheet);
procedure WriteConditionalStyle(AStream: TStream; AStyleName: String; const AFormat: TsCellFormat);
procedure WriteConditionalStyles(AStream: TStream); procedure WriteConditionalStyles(AStream: TStream);
procedure WriteEmptyRow(AStream: TStream; ASheet: TsBasicWorksheet; procedure WriteEmptyRow(AStream: TStream; ASheet: TsBasicWorksheet;
ARowIndex, AFirstColIndex, ALastColIndex, ALastRowIndex: Integer; ARowIndex, AFirstColIndex, ALastColIndex, ALastRowIndex: Integer;
@ -210,6 +208,8 @@ type
procedure WriteRowStyles(AStream: TStream); procedure WriteRowStyles(AStream: TStream);
procedure WriteRowsAndCells(AStream: TStream; ASheet: TsBasicWorksheet); procedure WriteRowsAndCells(AStream: TStream; ASheet: TsBasicWorksheet);
procedure WriteShapes(AStream: TStream; ASheet: TsBasicWorksheet); procedure WriteShapes(AStream: TStream; ASheet: TsBasicWorksheet);
procedure WriteStyleNode(AStream: TStream; const AStyleName: String;
const AFormat: TsCellFormat; AConditionalFormatIndex: Integer);
procedure WriteTableSettings(AStream: TStream); procedure WriteTableSettings(AStream: TStream);
procedure WriteTableStyles(AStream: TStream); procedure WriteTableStyles(AStream: TStream);
procedure WriteTextStyles(AStream: TStream); procedure WriteTextStyles(AStream: TStream);
@ -2475,7 +2475,6 @@ var
p: Integer; p: Integer;
fmt: PsCellFormat; fmt: PsCellFormat;
ns: String; ns: String;
hasFormula: Boolean;
begin begin
{$IFDEF FPSpreadDebug} {$IFDEF FPSpreadDebug}
DebugLn(Format('[ReadFormula] ARow=%d, ACol=%d, AStyleIndex=%d', [ARow, ACol, AStyleIndex])); DebugLn(Format('[ReadFormula] ARow=%d, ACol=%d, AStyleIndex=%d', [ARow, ACol, AStyleIndex]));
@ -2490,10 +2489,6 @@ begin
cell := TsWorksheet(FWorksheet).GetCell(ARow, ACol); // Don't use AddCell here cell := TsWorksheet(FWorksheet).GetCell(ARow, ACol); // Don't use AddCell here
ApplyStyleToCell(cell, AStyleIndex); ApplyStyleToCell(cell, AStyleIndex);
{
styleName := GetAttrValue(ACellNode, 'table:style-name');
ApplyStyleToCell(cell, stylename);
}
fmt := TsWorkbook(Workbook).GetPointerToCellFormat(cell^.FormatIndex); fmt := TsWorkbook(Workbook).GetPointerToCellFormat(cell^.FormatIndex);
formulaStr := ''; formulaStr := '';
@ -2520,13 +2515,11 @@ begin
formula^.Parser.Expression[fdOpenDocument] := formulaStr; // Parse in ODS dialect formula^.Parser.Expression[fdOpenDocument] := formulaStr; // Parse in ODS dialect
formula^.Text := formula^.Parser.Expression[fdExcelA1]; // Convert to Excel A1 dialect formula^.Text := formula^.Parser.Expression[fdExcelA1]; // Convert to Excel A1 dialect
cell^.Flags := cell^.Flags + [cfHasFormula]; cell^.Flags := cell^.Flags + [cfHasFormula];
hasFormula := true;
{$IFDEF FPSpreadDebug} {$IFDEF FPSpreadDebug}
DebugLn(' Formula found: ' + formula); DebugLn(' Formula found: ' + formula);
{$ENDIF} {$ENDIF}
end else end;
hasFormula := false;
// Read formula results // Read formula results
@ -3698,7 +3691,7 @@ procedure TsSpreadOpenDocReader.ReadCellImages(ANode: TDOMNode;
ARow, ACol: Cardinal); ARow, ACol: Cardinal);
var var
childNode: TDOMNode; childNode: TDOMNode;
nodeName: String; {%H-}nodeName: String;
begin begin
childNode := ANode.FirstChild; childNode := ANode.FirstChild;
while Assigned(childNode) do while Assigned(childNode) do
@ -5331,6 +5324,87 @@ begin
'</office:document-settings>'); '</office:document-settings>');
end; end;
{ Writes the style node in "content.xml" as well as the conditional format
part of a style to "styles.xml". }
procedure TsSpreadopenDocWriter.WriteStyleNode(AStream: TStream;
const AStyleName: String; const AFormat: TsCellFormat;
AConditionalFormatIndex: Integer);
var
s: String;
nfs: String;
nfParams: TsNumFormatParams;
nfIdx: Integer;
j, p: Integer;
addProtection: Boolean;
begin
addProtection := (AConditionalFormatIndex = -1);
nfs := '';
nfidx := AFormat.NumberFormatIndex;
if nfidx <> -1 then
begin
nfParams := TsWorkbook(FWorkbook).GetNumberFormat(nfidx);
if nfParams <> nil then
begin
nfs := nfParams.NumFormatStr;
for j:=0 to NumFormatList.Count-1 do
begin
s := NumFormatList[j];
p := pos(':', s);
if SameText(Copy(s, p+1, Length(s)), nfs) then
begin
nfs := Format(' style:data-style-name="%s"', [copy(s, 1, p-1)]);
break;
end;
p := 0;
end;
if p = 0 then // not found
nfs := '';
end;
end;
AppendToStream(AStream, Format(
'<style:style style:name="%s" style:family="table-cell" ' +
'style:parent-style-name="Default"%s>',
[AStyleName, nfs]
));
// style:text-properties ---> font
s := WriteFontStyleXMLAsString(AFormat);
if s <> '' then
AppendToStream(AStream,
'<style:text-properties '+ s + '/>');
// - border, background, wordwrap, text rotation, vertical alignment
s := WriteBorderStyleXMLAsString(AFormat) +
WriteBackgroundColorStyleXMLAsString(AFormat) +
WriteWordwrapStyleXMLAsString(AFormat) +
WriteTextRotationStyleXMLAsString(AFormat) +
WriteVertAlignmentStyleXMLAsString(AFormat);
if addProtection then
s := s + WriteCellProtectionStyleXMLAsString(AFormat);
if s <> '' then
AppendToStream(AStream,
'<style:table-cell-properties ' + s + '/>');
// style:paragraph-properties ---> hor alignment, bidi
s := WriteHorAlignmentStyleXMLAsString(AFormat) +
WriteBiDiModeStyleXMLAsString(AFormat);
if s <> '' then
AppendToStream(AStream,
'<style:paragraph-properties ' + s + '/>');
if (AConditionalFormatIndex > -1) then
begin
s := WriteConditionalStyleXMLAsString(AConditionalFormatIndex);
if s <> '' then
AppendToStream(AStream, s);
end;
AppendToStream(AStream,
'</style:style>');
end;
{ Writes the file "styles.xml" } { Writes the file "styles.xml" }
procedure TsSpreadOpenDocWriter.WriteStyles; procedure TsSpreadOpenDocWriter.WriteStyles;
begin begin
@ -5531,104 +5605,6 @@ begin
'</table:table>'); '</table:table>');
end; end;
{ Writes the style node in "content.xml" }
procedure TsSpreadOpenDocWriter.WriteCellStyle(AStream: TStream;
AFormatIndex, AConditionalFormatIndex: integer);
var
book: TsWorkbook;
fmt: TsCellFormat;
nfs: String;
nfParams: TsNumFormatParams;
nfidx: Integer;
s: String;
p: Integer;
j: Integer;
stylename: String;
cf: TsConditionalFormat;
isConditionalFormat: Boolean;
begin
book := TsWorkbook(FWorkbook);
isConditionalFormat := AConditionalFormatIndex > -1;
// The style name will be 'ce' plus format index in the workbook's CellFormats
// list.
// In case of a conditional format the style name is a combination of
// conditional format index and normal format index.
if isConditionalFormat then
styleName := 'ce' + IntToStr(1000 * (AConditionalFormatIndex+1) + AFormatIndex)
else
styleName := 'ce' + IntToStr(AFormatIndex);
fmt := book.GetCellFormat(AFormatIndex);
nfs := '';
nfidx := fmt.NumberFormatIndex;
if nfidx <> -1 then
begin
nfParams := book.GetNumberFormat(nfidx);
if nfParams <> nil then
begin
nfs := nfParams.NumFormatStr;
for j:=0 to NumFormatList.Count-1 do
begin
s := NumFormatList[j];
p := pos(':', s);
if SameText(Copy(s, p+1, Length(s)), nfs) then
begin
nfs := Format('style:data-style-name="%s"', [copy(s, 1, p-1)]);
break;
end;
p := 0;
end;
if p = 0 then // not found
nfs := '';
end;
end;
// Start and name
AppendToStream(AStream,
'<style:style style:name="' + styleName + '" style:family="table-cell" ' +
'style:parent-style-name="Default" '+ nfs + '>');
// style:text-properties
// - font
s := WriteFontStyleXMLAsString(fmt);
if s <> '' then
AppendToStream(AStream,
'<style:text-properties '+ s + '/>');
// - border, background, wordwrap, text rotation, vertical alignment
s := WriteBorderStyleXMLAsString(fmt) +
WriteBackgroundColorStyleXMLAsString(fmt) +
WriteWordwrapStyleXMLAsString(fmt) +
WriteTextRotationStyleXMLAsString(fmt) +
WriteVertAlignmentStyleXMLAsString(fmt);
if not isConditionalFormat then
s := s + WriteCellProtectionStyleXMLAsString(fmt);
if s <> '' then
AppendToStream(AStream,
'<style:table-cell-properties ' + s + '/>');
// style:paragraph-properties
// - hor alignment, bidi
s := WriteHorAlignmentStyleXMLAsString(fmt) +
WriteBiDiModeStyleXMLAsString(fmt);
if s <> '' then
AppendToStream(AStream,
'<style:paragraph-properties ' + s + '/>');
if isConditionalFormat then
begin
s := WriteConditionalStyleXMLAsString(AConditionalFormatIndex);
if s <> '' then
AppendToStream(AStream, s);
end;
// End
AppendToStream(AStream,
'</style:style>');
end;
{ Writes the cell styles ("ce0", "ce1", ...). Directly maps to the CellFormats { Writes the cell styles ("ce0", "ce1", ...). Directly maps to the CellFormats
list of the workbook. "ce0" is the default format } list of the workbook. "ce0" is the default format }
@ -5638,20 +5614,24 @@ var
cf: TsConditionalFormat; cf: TsConditionalFormat;
cf_sheet: TsWorksheet; cf_sheet: TsWorksheet;
cf_range: TsCellRange; cf_range: TsCellRange;
cf_rule: TsCFCellRule;
ncf: Integer; ncf: Integer;
i, j: Integer; i: Integer;
cell: PCell; cell: PCell;
r, c: Cardinal; r, c: Cardinal;
L: TStrings; L: TStrings;
s: String; s: String;
fmtIndex, cfIndex: Integer; styleName: String;
fmtIndex: Integer = 0;
cfIndex: Integer = 0;
begin begin
book := TsWorkbook(FWorkbook); book := TsWorkbook(FWorkbook);
// Write fixed formats only // Write fixed formats only
for i := 0 to book.GetNumCellFormats - 1 do for i := 0 to book.GetNumCellFormats - 1 do
WriteCellStyle(AStream, i, -1); begin
styleName := 'ce' + IntToStr(i);
WriteStyleNode(AStream, styleName, book.GetCellFormat(i), -1);
end;
// Conditional formats contain the fixed formats plus the condition params // Conditional formats contain the fixed formats plus the condition params
// To avoid duplicate style entries in the file we first collect all style // To avoid duplicate style entries in the file we first collect all style
@ -5675,19 +5655,22 @@ begin
(cell^.ConditionalFormatIndex[High(cell^.ConditionalFormatIndex)] = i) (cell^.ConditionalFormatIndex[High(cell^.ConditionalFormatIndex)] = i)
then begin then begin
s := 'ce' + IntToStr((i+1) * 1000 + cell^.FormatIndex); s := 'ce' + IntToStr((i+1) * 1000 + cell^.FormatIndex);
// To distinguish conditional from fixed format numbers we increment
// cfIndex by 1 to have thousands in the number even when cfIndex = 0.
if L.IndexOf(s) = -1 then if L.IndexOf(s) = -1 then
L.Add(s); L.Add(s);
end; end;
end; end;
end; end;
// Now write the combined styles to the stream. The styles can be identified // Now write the combined styles to the stream. The style names were stored
// from the style name in the string list. // in the unique way in the string list; the format index can be extracted
// from the style name.
for i := 0 to L.Count-1 do begin for i := 0 to L.Count-1 do begin
styleName := L.Strings[i];
s := Copy(L[i], 3, MaxInt); // remove 'ce' s := Copy(L[i], 3, MaxInt); // remove 'ce'
j := StrToInt(s); DivMod(StrToInt(s), 1000, cfIndex, fmtIndex); // extract cfIndex and fmt Index from style name
DivMod(j, 1000, cfIndex, fmtIndex); WriteStyleNode(AStream, styleName, book.GetCellFormat(fmtIndex), cfIndex-1); // cfIndex was incremented by 1.
WriteCellStyle(AStream, fmtIndex, cfIndex-1);
end; end;
finally finally
L.Free; L.Free;
@ -5698,10 +5681,7 @@ procedure TsSpreadOpenDocWriter.WriteColStyles(AStream: TStream);
var var
i: Integer; i: Integer;
colstyle: TColumnStyleData; colstyle: TColumnStyleData;
book: TsWorkbook;
begin begin
book := TsWorkbook(FWorkbook);
if FColumnStyleList.Count = 0 then if FColumnStyleList.Count = 0 then
begin begin
AppendToStream(AStream, AppendToStream(AStream,
@ -5911,13 +5891,12 @@ var
cf_range: TsCellRange; cf_range: TsCellRange;
cf_styleName: String; cf_styleName: String;
cf_cellRule: TsCFCellRule; cf_cellRule: TsCFCellRule;
i, j, k: Integer; i,j: Integer;
sheet: TsWorksheet; sheet: TsWorksheet;
rangeStr: String; rangeStr: String;
firstCellStr: string; firstCellStr: string;
value1Str, value2Str: String; value1Str, value2Str: String;
opStr: String; opStr: String;
s: String;
begin begin
book := TsWorkbook(FWorkbook); book := TsWorkbook(FWorkbook);
sheet := TsWorksheet(ASheet); sheet := TsWorksheet(ASheet);
@ -5939,27 +5918,17 @@ begin
rangeStr rangeStr
])); ]));
for k := 0 to cf.RulesCount-1 do for j := 0 to cf.RulesCount-1 do
begin begin
value1Str := ''; if cf.Rules[j] is TsCFCellRule then
value2Str := '';
opStr := '';
if cf.Rules[k] is TsCFCellRule then
begin begin
cf_cellRule := TsCFCellRule(cf.Rules[k]); cf_cellRule := TsCFCellRule(cf.Rules[j]);
cf_styleName := Format('conditional_%d', [cf_CellRule.FormatIndex]); cf_styleName := Format('conditional_%d', [cf_CellRule.FormatIndex]);
value1Str := CFOperandToStr(cf_cellRule.Operand1, sheet); value1Str := CFOperandToStr(cf_cellRule.Operand1, sheet);
value2Str := CFOperandToStr(cf_cellRule.Operand2, sheet); value2Str := CFOperandToStr(cf_cellRule.Operand2, sheet);
opStr := Format(CF_CALCEXT_OP[cf_cellRule.Condition], [value1Str, value2str]); opStr := Format(CF_CALCEXT_OP[cf_cellRule.Condition], [value1Str, value2str]);
if opStr <> '' then if opStr <> '' then
begin begin
// Fix formula syntax
s := VarToStr(cf_cellRule.Operand1);
{
if (Length(s) > 1) and (s[1] = '=') then
opStr := 'of:' + opStr;
}
// construct calcext string
AppendToStream(AStream, Format( AppendToStream(AStream, Format(
'<calcext:condition calcext:apply-style-name="%s" calcext:value="%s" calcext:base-cell-address="%s" />', '<calcext:condition calcext:apply-style-name="%s" calcext:value="%s" calcext:base-cell-address="%s" />',
[cf_stylename, opStr, firstCellStr] [cf_stylename, opStr, firstCellStr]
@ -5975,47 +5944,22 @@ begin
'</calcext:conditional-formats>' ); '</calcext:conditional-formats>' );
end; end;
{ Writes the conditional format part of a style to "styles.xml". }
procedure TsSpreadopenDocWriter.WriteConditionalStyle(AStream: TStream;
AStyleName: String; const AFormat: TsCellFormat);
var
s: String;
begin
AppendToStream(AStream, Format(
'<style:style style:name="%s" style:family="table-cell" style:parent-style-name="Default">',
[AStyleName]));
AppendToStream(AStream, Format(
'<style:table-cell-properties %s%s />', [
WriteBackgroundColorStyleXMLAsString(AFormat),
WriteBorderStyleXMLAsString(AFormat)
// To do: add the remaining style elements
]));
s := WriteFontStyleXMLAsString(AFormat);
if s <> '' then
AppendToStream(AStream,
'<style:text-properties '+ s + '/>');
AppendToStream(AStream,
'</style:style>');
end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Writes the styles used by conditional formatting to "styles.xml". Writes the styles used by conditional formatting to "styles.xml".
In total there are three parts which must be implemented In total there are four parts which must be implemented
for condtional formatting: for condtional formatting:
#1 Definition of the styles (here, and in WriteConditionalStyle) (can be #1 Definition of the styles (here, and in WriteStyleNode) (can be omitted if
omitted if one of the already existing styles is used) one of the already existing styles is used)
#2 Definition of the cell styles (in WriteCellStyles), style:map nodes) #2 Definition of the cell styles in contents.xml
#3 Definition of the cell ranges in WriteConditionalFormats (in WriteCellStyles), style:map nodes)
#3 Definition of the cell ranges in WriteConditionalFormats in content.xml
(calcext:conditional-formattings node) (calcext:conditional-formattings node)
#4 Find the correct style when cells are written in content.xml
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsSpreadOpenDocWriter.WriteConditionalStyles(AStream: TStream); procedure TsSpreadOpenDocWriter.WriteConditionalStyles(AStream: TStream);
var var
book: TsWorkbook; book: TsWorkbook;
sheet: TsWorksheet; i, j: Integer;
i, j, k: Integer;
nCF: Integer; nCF: Integer;
CF: TsConditionalFormat; CF: TsConditionalFormat;
fmt: TsCellFormat; fmt: TsCellFormat;
@ -6041,7 +5985,7 @@ begin
fmt := book.GetCellFormat(TsCFCellRule(cf_Rule).FormatIndex); fmt := book.GetCellFormat(TsCFCellRule(cf_Rule).FormatIndex);
stylename := Format('conditional_%d', [fmtIndex]); stylename := Format('conditional_%d', [fmtIndex]);
if L.IndexOf(styleName) = -1 then begin if L.IndexOf(styleName) = -1 then begin
WriteConditionalStyle(AStream, stylename, fmt); WriteStyleNode(AStream, stylename, fmt, i);
L.Add(styleName); L.Add(styleName);
end; end;
end; end;
@ -6600,7 +6544,6 @@ var
col: PCol; col: PCol;
cell: PCell; cell: PCell;
stylename: string; stylename: string;
h: Single;
firstcol: Integer; firstcol: Integer;
lastcol: Integer; lastcol: Integer;
c, cc: integer; c, cc: integer;
@ -7179,7 +7122,6 @@ var
comment: String; comment: String;
strValue: String; strValue: String;
displayStr: String; displayStr: String;
fmt: TsCellFormat;
begin begin
Unused(ARow, ACol); Unused(ARow, ACol);
@ -7381,7 +7323,6 @@ var
cf_Sheet: TsWorksheet; cf_Sheet: TsWorksheet;
firstCellOfRange: String; firstCellOfRange: String;
operand1Str, operand2Str: String; operand1Str, operand2Str: String;
s: String;
begin begin
Result := ''; Result := '';
@ -7401,13 +7342,6 @@ begin
cf_condition := Format(CF_STYLE_OP[cf_cellRule.Condition], [operand1Str, operand2Str]); cf_condition := Format(CF_STYLE_OP[cf_cellRule.Condition], [operand1Str, operand2Str]);
if cf_Condition <> '' then begin if cf_Condition <> '' then begin
// Fix formula syntax
(*
s := VarToStr(cf_cellRule.Operand1);
if (Length(s) > 1) and (s[1] = '=') then
cf_condition := 'of:' + cf_Condition;
*)
// Build style:map string
Result := Result + Result := Result +
Format('<style:map style:condition="%s" style:apply-style-name="%s" style:base-cell-address="%s" />', [ Format('<style:map style:condition="%s" style:apply-style-name="%s" style:base-cell-address="%s" />', [
cf_Condition, cf_Condition,
@ -7478,7 +7412,6 @@ end;
procedure TsSpreadOpenDocWriter.WriteError(AStream: TStream; procedure TsSpreadOpenDocWriter.WriteError(AStream: TStream;
const ARow, ACol: Cardinal; const AValue: TsErrorValue; ACell: PCell); const ARow, ACol: Cardinal; const AValue: TsErrorValue; ACell: PCell);
var var
fmt: PsCellFormat;
lStyle: String; lStyle: String;
comment: String; comment: String;
rowsSpannedStr, colsSpannedStr: String; rowsSpannedStr, colsSpannedStr: String;
@ -8281,7 +8214,6 @@ var
spannedStr: String; spannedStr: String;
comment: String; comment: String;
r1,c1,r2,c2: Cardinal; r1,c1,r2,c2: Cardinal;
fmt: TsCellFormat;
ignoreFormulas: Boolean; ignoreFormulas: Boolean;
sheet: TsWorksheet; sheet: TsWorksheet;
oldDialect: TsFormulaDialect; oldDialect: TsFormulaDialect;
@ -8426,7 +8358,6 @@ var
spannedStr: String; spannedStr: String;
r1,c1,r2,c2: Cardinal; r1,c1,r2,c2: Cardinal;
totaltxt, target, bookmark, comment: String; totaltxt, target, bookmark, comment: String;
fmt: TsCellFormat;
fnt: TsFont; fnt: TsFont;
fntName: String; fntName: String;
hyperlink: PsHyperlink; hyperlink: PsHyperlink;

View File

@ -726,6 +726,9 @@ type
procedure SetBorders(ABorders: TsCellBorders; procedure SetBorders(ABorders: TsCellBorders;
AColor: TsColor = scBlack; ALineStyle: TsLineStyle = lsThin); AColor: TsColor = scBlack; ALineStyle: TsLineStyle = lsThin);
procedure SetFont(AFontIndex: Integer); procedure SetFont(AFontIndex: Integer);
procedure SetHorAlignment(AHorAlign: TsHorAlignment);
procedure SetTextRotation(ARotation: TsTextRotation);
procedure SetVertAlignment(AVertAlign: TsVertAlignment);
end; end;
{@@ Pointer to a format record } {@@ Pointer to a format record }
@ -1112,6 +1115,24 @@ begin
UsedFormattingFields := UsedFormattingFields + [uffFont]; UsedFormattingFields := UsedFormattingFields + [uffFont];
end; end;
procedure TsCellFormat.SetHorAlignment(AHorAlign: TsHorAlignment);
begin
HorAlignment := AHorAlign;
UsedFormattingFields := usedFormattingFields + [uffHorAlign];
end;
procedure TsCellFormat.SetTextRotation(ARotation: TsTextRotation);
begin
TextRotation := ARotation;
UsedFormattingFields := UsedFormattingFields + [uffTextRotation];
end;
procedure TsCellFormat.SetVertAlignment(AVertAlign: TsVertAlignment);
begin
VertAlignment := AVertAlign;
UsedFormattingfields := UsedFormattingFields + [uffVertAlign];
end;
{ TsFont } { TsFont }