fpspreadsheet: Public methods AutoRowHeight and AutoColWidth of the WorksheetGrid. Show value of cell's WordWrap in SpreadsheetInspector.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4880 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-01 16:43:00 +00:00
parent 90b0a58290
commit d7477c8171
3 changed files with 28 additions and 5 deletions

View File

@ -7819,7 +7819,7 @@ procedure TsWorkbook.RemoveWorksheet(AWorksheet: TsWorksheet);
var
i: Integer;
begin
if GetWorksheetCount > 1 then // There must be at least 1 worksheet!
if GetWorksheetCount > 1 then // There must be at least 1 worksheet left!
begin
i := GetWorksheetIndex(AWorksheet);
if (i <> -1) and (AWorksheet <> nil) then

View File

@ -3020,6 +3020,12 @@ begin
GetEnumName(TypeInfo(TsVertAlignment), ord(fmt.VertAlignment))
]));
if (ACell=nil) or not (uffWordwrap in fmt.UsedFormattingFields)
then AStrings.Add('Wordwrap=(default)')
else AStrings.Add(Format('Wordwrap=%s', [
BoolToStr(uffWordwrap in fmt.UsedFormattingFields, true)
]));
if (ACell=nil) or not (uffBorder in fmt.UsedFormattingFields) then
AStrings.Add('Borders=(none)')
else

View File

@ -119,7 +119,7 @@ type
function GetNumberFormats(ALeft, ATop, ARight, ABottom: Integer): String;
function GetRowHeights(ARow: Integer): Integer;
function GetShowGridLines: Boolean;
function GetShowHeaders: Boolean;
function GetShowHeaders: Boolean; inline;
function GetTextRotation(ACol, ARow: Integer): TsTextRotation;
function GetTextRotations(ALeft, ATop, ARight, ABottom: Integer): TsTextRotation;
function GetVertAlignment(ACol, ARow: Integer): TsVertAlignment;
@ -273,6 +273,8 @@ type
destructor Destroy; override;
procedure BeginUpdate;
procedure AutoColWidth(ACol: Integer);
procedure AutoRowHeight(ARow: Integer);
function CellRect(ACol1, ARow1, ACol2, ARow2: Integer): TRect; overload;
procedure Clear;
procedure DefaultDrawCell(ACol, ARow: Integer; var ARect: TRect; AState: TGridDrawState); override;
@ -1008,6 +1010,16 @@ begin
inherited Destroy;
end;
procedure TsCustomWorksheetGrid.AutoColWidth(ACol: Integer);
begin
AutoAdjustColumn(ACol);
end;
procedure TscustomWorksheetGrid.AutoRowHeight(ARow: Integer);
begin
AutoAdjustRow(ARow);
end;
{@@ ----------------------------------------------------------------------------
Is called when goDblClickAutoSize is in the grid's options and a double click
has occured at the border of a column header. Sets optimum column with.
@ -3027,7 +3039,7 @@ var
RTL: Boolean;
begin
Result := 0;
if ShowHeaders and ((ACol = 0) or (ARow = 0)) then
if (ACol < FHeaderCount) or (ARow < FHeaderCount) then
exit;
if Worksheet = nil then
exit;
@ -5746,10 +5758,15 @@ procedure TsCustomWorksheetGrid.SetWordwrap(ACol, ARow: Integer;
var
cell: PCell;
begin
if Assigned(Worksheet) then
begin
if not Assigned(Worksheet) then
exit;
BeginUpdate;
try
cell := Worksheet.GetCell(GetWorksheetRow(ARow), GetWorksheetCol(ACol));
Worksheet.WriteWordwrap(cell, AValue);
finally
EndUpdate;
end;
end;