You've already forked lazarus-ccr
fpspreadsheet: improve auto row height behavior of fpspreadsheetGrid (remove property AutoRowHeights introduced a few revisions earlier, this is now determined from the value in the file).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3003 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -117,7 +117,7 @@
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="10" Y="7"/>
|
||||
<UsageCount Value="125"/>
|
||||
<UsageCount Value="127"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -127,36 +127,33 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="mainform"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="125"/>
|
||||
<CursorPos X="68" Y="141"/>
|
||||
<UsageCount Value="125"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="1" Y="142" ID="1"/>
|
||||
</Bookmarks>
|
||||
<CursorPos X="18" Y="134"/>
|
||||
<UsageCount Value="127"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<UnitName Value="fpspreadsheet"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="111"/>
|
||||
<CursorPos X="18" Y="126"/>
|
||||
<UsageCount Value="60"/>
|
||||
<TopLine Value="805"/>
|
||||
<CursorPos X="56" Y="808"/>
|
||||
<UsageCount Value="61"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<UnitName Value="fpspreadsheetgrid"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="36"/>
|
||||
<CursorPos X="3" Y="62"/>
|
||||
<UsageCount Value="61"/>
|
||||
<TopLine Value="793"/>
|
||||
<CursorPos X="1" Y="808"/>
|
||||
<UsageCount Value="62"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
@ -225,10 +222,12 @@
|
||||
<Unit12>
|
||||
<Filename Value="d:\lazarus-svn\lcl\grids.pas"/>
|
||||
<UnitName Value="Grids"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="3963"/>
|
||||
<CursorPos X="2" Y="3981"/>
|
||||
<TopLine Value="2622"/>
|
||||
<CursorPos X="1" Y="2648"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\..\fpsutils.pas"/>
|
||||
@ -237,7 +236,7 @@
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="35"/>
|
||||
<CursorPos X="1" Y="62"/>
|
||||
<UsageCount Value="36"/>
|
||||
<UsageCount Value="37"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
@ -250,11 +249,11 @@
|
||||
<Unit15>
|
||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||
<UnitName Value="Graphics"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="649"/>
|
||||
<CursorPos X="28" Y="675"/>
|
||||
<UsageCount Value="27"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
@ -267,11 +266,11 @@
|
||||
<Unit17>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<UnitName Value="xlsbiff8"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="284"/>
|
||||
<CursorPos X="1" Y="305"/>
|
||||
<UsageCount Value="35"/>
|
||||
<TopLine Value="1568"/>
|
||||
<CursorPos X="38" Y="1594"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
@ -292,31 +291,31 @@
|
||||
<Unit20>
|
||||
<Filename Value="..\..\xlscommon.pas"/>
|
||||
<UnitName Value="xlscommon"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="515"/>
|
||||
<CursorPos X="35" Y="541"/>
|
||||
<UsageCount Value="31"/>
|
||||
<TopLine Value="850"/>
|
||||
<CursorPos X="41" Y="862"/>
|
||||
<UsageCount Value="32"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||
<UnitName Value="xlsbiff5"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="300"/>
|
||||
<CursorPos X="40" Y="310"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<UnitName Value="xlsbiff2"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="219"/>
|
||||
<CursorPos X="26" Y="233"/>
|
||||
<UsageCount Value="19"/>
|
||||
<TopLine Value="136"/>
|
||||
<CursorPos X="3" Y="153"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
@ -330,11 +329,11 @@
|
||||
<Unit24>
|
||||
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpcanvas.pp"/>
|
||||
<UnitName Value="FPCanvas"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="111"/>
|
||||
<CursorPos X="3" Y="112"/>
|
||||
<UsageCount Value="14"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
@ -355,143 +354,143 @@
|
||||
<Unit27>
|
||||
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
|
||||
<UnitName Value="Xls"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<EditorIndex Value="13"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="114"/>
|
||||
<CursorPos X="42" Y="152"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
<Filename Value="d:\lazarus-svn\lcl\include\pen.inc"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="272"/>
|
||||
<CursorPos X="3" Y="286"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit28>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1040" Column="1" TopLine="1014"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="315" Column="1" TopLine="295"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1043" Column="1" TopLine="1014"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="319" Column="1" TopLine="295"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1044" Column="1" TopLine="1014"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="324" Column="1" TopLine="297"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1077" Column="19" TopLine="1064"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="325" Column="1" TopLine="298"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="536" Column="32" TopLine="530"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="326" Column="1" TopLine="299"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="124" Column="32" TopLine="97"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="327" Column="1" TopLine="300"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="537" Column="24" TopLine="517"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="328" Column="1" TopLine="301"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="283" Column="14" TopLine="272"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="330" Column="1" TopLine="304"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="124" Column="30" TopLine="104"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="331" Column="1" TopLine="305"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="283" Column="9" TopLine="251"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="337" Column="1" TopLine="321"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
|
||||
<Caret Line="130" Column="20" TopLine="113"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="338" Column="1" TopLine="321"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="290" Column="31" TopLine="238"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="341" Column="1" TopLine="321"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="233" Column="26" TopLine="219"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="348" Column="1" TopLine="328"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="1993" Column="32" TopLine="1989"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="312" Column="1" TopLine="307"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="441" Column="5" TopLine="376"/>
|
||||
<Caret Line="790" Column="19" TopLine="792"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="414" Column="1" TopLine="389"/>
|
||||
<Caret Line="806" Column="1" TopLine="793"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||
<Caret Line="1226" Column="14" TopLine="1212"/>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="807" Column="1" TopLine="793"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||
<Caret Line="636" Column="3" TopLine="619"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="540" Column="44" TopLine="540"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||
<Caret Line="1667" Column="95" TopLine="1637"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="2062" Column="79" TopLine="2048"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="62" Column="26" TopLine="35"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="418" Column="31" TopLine="374"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="397" Column="41" TopLine="397"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||
<Caret Line="586" Column="3" TopLine="570"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="392" Column="6" TopLine="388"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="62" Column="26" TopLine="35"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
|
||||
<Caret Line="1226" Column="14" TopLine="1212"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="423" Column="41" TopLine="397"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="250" Column="38" TopLine="235"/>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="72" Column="68" TopLine="72"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="833" Column="3" TopLine="830"/>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
|
||||
<Caret Line="826" Column="3" TopLine="823"/>
|
||||
<Filename Value="..\..\xlscommon.pas"/>
|
||||
<Caret Line="859" Column="51" TopLine="859"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="53" Column="17" TopLine="67"/>
|
||||
<Filename Value="..\..\xlscommon.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="142" Column="1" TopLine="129"/>
|
||||
<Filename Value="..\..\xlscommon.pas"/>
|
||||
<Caret Line="374" Column="26" TopLine="349"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<Caret Line="33" Column="1" TopLine="33"/>
|
||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||
<Caret Line="409" Column="3" TopLine="403"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
@ -521,6 +520,15 @@
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<BreakPoints Count="1">
|
||||
<Item1>
|
||||
<Kind Value="bpkSource"/>
|
||||
<WatchScope Value="wpsLocal"/>
|
||||
<WatchKind Value="wpkWrite"/>
|
||||
<Source Value="..\..\xlsbiff2.pas"/>
|
||||
<Line Value="553"/>
|
||||
</Item1>
|
||||
</BreakPoints>
|
||||
<Watches Count="2">
|
||||
<Item1>
|
||||
<Expression Value="lcell^.fontindex"/>
|
||||
|
@ -289,7 +289,8 @@ type
|
||||
|
||||
TRow = record
|
||||
Row: Cardinal;
|
||||
Height: Single; // in millimeters
|
||||
Height: Single; // in millimeters
|
||||
AutoHeight: Boolean; // true: height corresponds to font; false: use Height
|
||||
end;
|
||||
|
||||
PRow = ^TRow;
|
||||
@ -811,6 +812,10 @@ begin
|
||||
FCells := TAVLTree.Create(@CompareCells);
|
||||
FRows := TIndexedAVLTree.Create(@CompareRows);
|
||||
FCols := TIndexedAVLTree.Create(@CompareCols);
|
||||
|
||||
FShowGridLines := true;
|
||||
FShowHeaders := true;
|
||||
FSelected := true;
|
||||
end;
|
||||
|
||||
{@@
|
||||
|
@ -25,14 +25,12 @@ type
|
||||
FWorkbook: TsWorkbook;
|
||||
FWorksheet: TsWorksheet;
|
||||
FDisplayFixedColRow: Boolean;
|
||||
FAutoRowHeights: Boolean;
|
||||
function CalcAutoRowHeight(ARow: Integer): Integer;
|
||||
function CalcColWidth(AWidth: Single): Integer;
|
||||
function CalcRowHeight(AHeight: Single): Integer;
|
||||
procedure SetAutoRowHeights(AValue: Boolean);
|
||||
procedure SetDisplayFixedColRow(AValue: Boolean);
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure DoAutoRowHeights;
|
||||
procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override;
|
||||
procedure DrawAllRows; override;
|
||||
procedure DrawTextInCell(ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); override;
|
||||
@ -40,7 +38,6 @@ type
|
||||
function GetCellText(ACol, ARow: Integer): String;
|
||||
procedure Loaded; override;
|
||||
procedure Setup;
|
||||
property AutoRowHeights: Boolean read FAutoRowHeights write SetAutoRowHeights default true;
|
||||
property DisplayFixedColRow: Boolean read FDisplayFixedColRow write SetDisplayFixedColRow;
|
||||
public
|
||||
{ public methods }
|
||||
@ -62,7 +59,6 @@ type
|
||||
TsWorksheetGrid = class(TsCustomWorksheetGrid)
|
||||
published
|
||||
// inherited from TsCustomWorksheetGrid
|
||||
property AutoRowHeights;
|
||||
property DisplayFixedColRow;
|
||||
|
||||
// inherited from other ancestors
|
||||
@ -260,7 +256,6 @@ end;
|
||||
constructor TsCustomWorksheetGrid.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FAutoRowHeights := true;
|
||||
FDisplayFixedColRow := true;
|
||||
end;
|
||||
|
||||
@ -281,29 +276,28 @@ begin
|
||||
Result := Round(AWidth * w0);
|
||||
end;
|
||||
|
||||
// Converts the row height, given in mm, to pixels
|
||||
{ Finds the max cell height per row and uses this to define the RowHeights[].
|
||||
Returns DefaultRowHeight if the row does not contain any cells. }
|
||||
function TsCustomWorksheetGrid.CalcAutoRowHeight(ARow: Integer): Integer;
|
||||
var
|
||||
c: Integer;
|
||||
h: Integer;
|
||||
begin
|
||||
h := 0;
|
||||
for c := FixedCols to ColCount-1 do
|
||||
h := Max(h, GetCellHeight(c, ARow));
|
||||
if h = 0 then
|
||||
Result := DefaultRowHeight
|
||||
else
|
||||
Result := h;
|
||||
end;
|
||||
|
||||
{ Converts the row height, given in mm, to pixels }
|
||||
function TsCustomWorksheetGrid.CalcRowHeight(AHeight: Single): Integer;
|
||||
begin
|
||||
Result := round(AHeight / 25.4 * Screen.PixelsPerInch) + 4;
|
||||
end;
|
||||
|
||||
{ Finds the max cell height per row and uses this to define the RowHeights[]. }
|
||||
procedure TsCustomWorksheetGrid.DoAutoRowHeights;
|
||||
var
|
||||
r, c: Integer;
|
||||
h: Integer;
|
||||
begin
|
||||
for r := FixedRows to RowCount-1 do begin
|
||||
h := 0;
|
||||
for c := FixedCols to ColCount-1 do
|
||||
h := Max(h, GetCellHeight(c, r));
|
||||
if h = 0 then
|
||||
RowHeights[r] := DefaultRowHeight
|
||||
else
|
||||
RowHeights[r] := h;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Adjusts the grid's canvas before painting a given cell. Considers, e.g.
|
||||
background color, horizontal alignment, vertical alignment, etc. }
|
||||
procedure TsCustomWorksheetGrid.DoPrepareCanvas(ACol, ARow: Integer;
|
||||
@ -315,6 +309,7 @@ var
|
||||
fnt: TsFont;
|
||||
style: TFontStyles;
|
||||
begin
|
||||
Canvas.Font.Assign(Font);
|
||||
Canvas.Brush.Bitmap := nil;
|
||||
ts := Canvas.TextStyle;
|
||||
if FDisplayFixedColRow then begin
|
||||
@ -380,6 +375,7 @@ var
|
||||
cell: PCell;
|
||||
c, r: Integer;
|
||||
rect: TRect;
|
||||
headerRect: TRect;
|
||||
|
||||
procedure DrawBorderLine(ACell: PCell; ARect: TRect; ABorder: TsCellBorder;
|
||||
ALineStyle: TsLineStyle);
|
||||
@ -394,6 +390,7 @@ var
|
||||
($FFFFFFFF, $FFFFFFFF, $07070707, $AAAAAAAA, $FFFFFFFF, $FFFFFFFF);
|
||||
var
|
||||
w: Integer;
|
||||
r: TRect;
|
||||
begin
|
||||
if ALineStyle = lsDouble then
|
||||
case ABorder of
|
||||
@ -419,11 +416,17 @@ var
|
||||
Canvas.Pen.Color := FWorkBook.GetPaletteColor(ACell^.BorderStyles[ABorder].Color);
|
||||
//Canvas.Pen.Pattern := PEN_PATTERNS[ACell^.BorderStyles[ABorder].LineStyle];
|
||||
//Canvas.Pen.EndCap := pecSquare;
|
||||
|
||||
if ARect.Bottom < headerRect.Bottom then exit;
|
||||
r := ARect;
|
||||
if ARect.Top < headerRect.Bottom then r.Top := headerRect.Bottom;
|
||||
|
||||
case ABorder of
|
||||
cbEast : Canvas.Line(ARect.Right-1, ARect.Top, ARect.Right-1, ARect.Bottom-w);
|
||||
cbEast : Canvas.Line(ARect.Right-1, r.Top, ARect.Right-1, ARect.Bottom-w);
|
||||
cbSouth: Canvas.Line(ARect.Left-1, ARect.Bottom-1, ARect.Right-w, ARect.Bottom-1);
|
||||
cbWest : Canvas.Line(ARect.Left-1, ARect.Top, ARect.Left-1, ARect.Bottom-w);
|
||||
cbNorth: Canvas.Line(ARect.Left-1, ARect.Top-1, ARect.Right-w, ARect.Top-1);
|
||||
cbWest : Canvas.Line(ARect.Left-1, r.Top, ARect.Left-1, ARect.Bottom-w);
|
||||
cbNorth: if ARect.Top >= headerRect.Bottom then
|
||||
Canvas.Line(ARect.Left-1, ARect.Top-1, ARect.Right-w, ARect.Top-1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -432,6 +435,11 @@ begin
|
||||
inherited;
|
||||
if FWorksheet = nil then exit;
|
||||
|
||||
if (FixedRows > 0) then
|
||||
HeaderRect := CellRect(0, 0)
|
||||
else
|
||||
HeaderRect := Classes.Rect(0, 0, 0, 0);
|
||||
|
||||
cell := FWorksheet.GetFirstCell;
|
||||
while cell <> nil do begin
|
||||
if (uffBorder in cell^.UsedFormattingFields) then begin
|
||||
@ -739,13 +747,6 @@ begin
|
||||
Setup;
|
||||
end;
|
||||
|
||||
procedure TsCustomWorksheetGrid.SetAutoRowHeights(AValue: Boolean);
|
||||
begin
|
||||
if AValue = FAutoRowHeights then Exit;
|
||||
FAutoRowHeights := AValue;
|
||||
Setup;
|
||||
end;
|
||||
|
||||
procedure TsCustomWorksheetGrid.SetDisplayFixedColRow(AValue: Boolean);
|
||||
begin
|
||||
if AValue = FDisplayFixedColRow then Exit;
|
||||
@ -801,17 +802,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
if FWorksheet <> nil then begin
|
||||
if FAutoRowHeights then
|
||||
DoAutoRowHeights
|
||||
else begin
|
||||
RowHeights[0] := DefaultRowHeight;
|
||||
for i := FixedRows to RowCount-1 do begin
|
||||
lRow := FWorksheet.FindRow(i - FixedRows);
|
||||
if (lRow <> nil) then
|
||||
RowHeights[i] := CalcRowHeight(lRow^.Height)
|
||||
else
|
||||
RowHeights[i] := DefaultRowHeight;
|
||||
end;
|
||||
RowHeights[0] := DefaultRowHeight;
|
||||
for i := FixedRows to RowCount-1 do begin
|
||||
lRow := FWorksheet.FindRow(i - FixedRows);
|
||||
if (lRow = nil) or lRow^.AutoHeight then
|
||||
RowHeights[i] := CalcAutoRowHeight(i)
|
||||
else
|
||||
RowHeights[i] := CalcRowHeight(lRow^.Height);
|
||||
end;
|
||||
if FWorksheet.ShowGridLines then
|
||||
Options := Options + [goHorzLine, goVertLine]
|
||||
|
@ -45,7 +45,6 @@ type
|
||||
WorkBookEncoding: TsEncoding;
|
||||
FWorksheet: TsWorksheet;
|
||||
FFont: TsFont;
|
||||
procedure ReadRowInfo(AStream: TStream);
|
||||
protected
|
||||
procedure ApplyCellFormatting(ARow, ACol: Cardinal; XFIndex: Word); override;
|
||||
procedure ExtractNumberFormat(AXFIndex: WORD;
|
||||
@ -60,6 +59,7 @@ type
|
||||
procedure ReadLabel(AStream: TStream); override;
|
||||
procedure ReadNumber(AStream: TStream); override;
|
||||
procedure ReadRowColXF(AStream: TStream; out ARow, ACol: Cardinal; out AXF: Word); override;
|
||||
procedure ReadRowInfo(AStream: TStream); override;
|
||||
procedure ReadXF(AStream: TStream);
|
||||
public
|
||||
{ General reading methods }
|
||||
@ -556,7 +556,8 @@ begin
|
||||
lRow := FWorksheet.GetRow(WordLEToN(rowrec.RowIndex));
|
||||
// Row height is encoded into the 15 remaining bits in units "twips" (1/20 pt)
|
||||
lRow^.Height := TwipsToMillimeters(h and $7FFF);
|
||||
end;
|
||||
end else
|
||||
lRow^.AutoHeight := true;
|
||||
end;
|
||||
|
||||
procedure TsSpreadBIFF2Reader.ReadXF(AStream: TStream);
|
||||
|
@ -866,6 +866,9 @@ type
|
||||
Col1: Word;
|
||||
Col2: Word;
|
||||
Height: Word;
|
||||
NotUsed1: Word;
|
||||
NotUsed2: Word; // not used in BIFF5-BIFF8
|
||||
Flags: DWord;
|
||||
end;
|
||||
var
|
||||
rowrec: TRowRecord;
|
||||
@ -878,7 +881,11 @@ begin
|
||||
lRow := FWorksheet.GetRow(WordLEToN(rowrec.RowIndex));
|
||||
// Row height is encoded into the 15 remaining bits in units "twips" (1/20 pt)
|
||||
lRow^.Height := TwipsToMillimeters(h and $7FFF);
|
||||
end;
|
||||
end else
|
||||
lRow^.Height := 0;
|
||||
lRow^.AutoHeight := rowrec.Flags and $00000040 = 0;
|
||||
// If this bit is set row height does not change font height, i.e. has been
|
||||
// changed manually.
|
||||
end;
|
||||
|
||||
{ Reads the WINDOW2 record containing information like "show grid lines", or
|
||||
|
Reference in New Issue
Block a user