fpspreadsheet: CopyWorksheetFrom now copies also the DefaultRowHeight. Remove deprecated properties DefaultRowHeight and DefaultColWidth (the corresponding Read/Write procedures must be used instead).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7530 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-07-08 20:06:56 +00:00
parent 9a4f358ae2
commit 178e0e9214
3 changed files with 12 additions and 38 deletions

View File

@ -87,8 +87,8 @@ type
FFirstColIndex: Cardinal;
FLastRowIndex: Cardinal;
FLastColIndex: Cardinal;
FDefaultColWidth: Single; // in "characters". Excel uses the width of char "0" in 1st font
FDefaultRowHeight: Single; // in "character heights", i.e. line count
FDefaultColWidth: Single;
FDefaultRowHeight: Single;
FSortParams: TsSortParams; // Parameters of the current sorting operation
FBiDiMode: TsBiDiMode;
FCryptoInfo: TsCryptoInfo;
@ -108,13 +108,10 @@ type
FOnWriteCellData: TsWorksheetWriteCellDataEvent;
{ Setter/Getter }
function GetDefaultColWidth: Single;
function GetDefaultRowHeight: Single;
function GetFormatSettings: TFormatSettings;
function GetIndex: Integer;
procedure SetBiDiMode(AValue: TsBiDiMode);
procedure SetDefaultColWidth(AValue: Single);
procedure SetDefaultRowHeight(AValue: Single);
procedure SetIndex(AValue: Integer);
procedure SetTabColor(AValue: TsColor);
procedure SetVirtualColCount(AValue: Cardinal);
@ -647,13 +644,6 @@ type
property TabColor: TsColor read FTabColor write SetTabColor default scNotDefined;
{@@ Workbook to which the worksheet belongs }
property Workbook: TsWorkbook read FWorkbook;
{@@ The default column width given in "character units" (width of the
character "0" in the default font) }
property DefaultColWidth: Single read GetDefaultColWidth write SetDefaultColWidth;
deprecated 'Use Read/WriteDefaultColWidth';
{@@ The default row height is given in "line count" (height of the default font }
property DefaultRowHeight: Single read GetDefaultRowHeight write SetDefaultRowHeight;
deprecated 'Use Read/WriteDefaultColWidth';
{@@ In VirtualMode, the value of VirtualColCount signals how many colums
will be transferred to the worksheet. }
property VirtualColCount: cardinal read FVirtualColCount write SetVirtualColCount;
@ -7285,26 +7275,6 @@ begin
ChangedCell(ACell^.Row, ACell^.Col);
end;
function TsWorksheet.GetDefaultColWidth: Single;
begin
Result := ReadDefaultColWidth(suChars);
end;
procedure TsWorksheet.SetDefaultColWidth(AValue: Single);
begin
WriteDefaultColWidth(AValue, suChars);
end;
function TsWorksheet.GetDefaultRowHeight: Single;
begin
Result := ReadDefaultRowHeight(suLines);
end;
procedure TsWorksheet.SetDefaultRowHeight(AValue: Single);
begin
WriteDefaultRowHeight(AValue, suLines);
end;
function TsWorksheet.GetFormatSettings: TFormatSettings;
begin
Result := FWorkbook.FormatSettings;
@ -9267,7 +9237,7 @@ var
col: PCol;
row: PRow;
i: Integer;
w: Single;
w, h: Single;
fnt: TsFont;
begin
Result := nil;
@ -9285,8 +9255,12 @@ begin
end;
// Copy DefaultColWidth
w := AWorksheet.ReadDefaultColWidth(suMillimeters);
Result.WriteDefaultColWidth(w, suMillimeters);
w := AWorksheet.ReadDefaultColWidth(Units);
Result.WriteDefaultColWidth(w, Units);
// Copy DefaultRowHeight
h := AWorksheet.ReadDefaultRowHeight(Units);
Result.WriteDefaultRowHeight(h, Units);
// Copy cells (incl formulas, comments, hyperlinks etc).
for cell in AWorksheet.Cells do

View File

@ -429,7 +429,7 @@ begin
if lCol^.ColWidthType = cwtCustom then
w := lCol^.Width
else
w := sheet.DefaultColWidth;
w := sheet.ReadDefaultColWidth(sheet.Workbook.Units);
if not SameValue(w, w0) then
// if not SameValue(lCol^.Width, w, EPS) then
begin

View File

@ -995,7 +995,7 @@ type
FFormatID: TsSpreadFormatID;
FOptions: TsWorkbookOptions;
FProtection: TsWorkbookProtections;
FUnits: TsSizeUnits;
FUnits: TsSizeUnits; // Units for row heights and col widths
public
{@@ A copy of SysUtil's DefaultFormatSettings (converted to UTF8) to provide
some kind of localization to some formatting strings.