fpspreadsheet: Add units (mm, cm, in, pts, lines/chars) for column width and row heights. Update all demos (some issues left).

NOTE: This revision breaks existing code if the worksheet's DefaultRowHeight/DefaultColWidth is changed - value must be in millimeters now. Methods for accessing individual row heiths and column widths are fine, but are marked as deprecated, they use the old units. Optionally a unit parameter can be specified.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4568 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-03-18 19:50:40 +00:00
parent 08e1a619ca
commit 5b946b751f
65 changed files with 990 additions and 845 deletions

View File

@@ -1530,6 +1530,7 @@ begin
Result := true;
end;
{@@ ----------------------------------------------------------------------------
Excel's unit of row heights is "twips", i.e. 1/20 point.
Converts Twips to points.
@@ -1682,8 +1683,10 @@ end;
@return Value converted to millimeters
-------------------------------------------------------------------------------}
function PtsToMM(AValue: Double): Double;
const
PTS = 25.4 / 72.0;
begin
Result := AValue / 72 * 25.4;
Result := AValue * PTS;
end;
{@@ ----------------------------------------------------------------------------
@@ -2122,6 +2125,14 @@ end;
{@@ ----------------------------------------------------------------------------
Initializes the fields of a TsImage record
@param ARow Index of the anchor row
@param ACol Index of the anchor column
@param AOffsetX Distance of the left image edge from the left edge of the
anchor column. Measured in the units defined by the workbook.
@param AOffsetY Distance of the top image edge from the top edge of the
anchor row. Measured in the units defined by the workbook.
@return TsImage record containing these values.
-------------------------------------------------------------------------------}
procedure InitImageRecord(out AValue: TsImage; ARow, ACol: Cardinal;
AOffsetX, AOffsetY, AScaleX, AScaleY: Double);
@@ -2143,8 +2154,6 @@ begin
with AImage do
begin
Index := -1;
//ScaleX := 1.0;
//ScaleY := 1.0;
end;
end;