TdxSpreadSheetAlignHorizontalCenter Class
An action object that implements the AlignHorizontalCenter end-user command in Spreadsheet and Report Designer-based applications.
Declaration
TdxSpreadSheetAlignHorizontalCenter = class(
TdxSpreadSheetCustomAlignHorizontalAction
)
Remarks
This class does not introduce any new public members. Its overridden Execute function call centers the content horizontally in all cells selected in the active worksheet. As a result, the Style.AlignHorz property of all affected cell objects is set to ssahCenter.
If the content is already centered horizontally in all selected cells, the AlignHorizontalCenter command restores the horizontal alignment of the cells according to their content type (that is, centers logical values and aligns numeric values to the right border).
UI elements linked to a TdxSpreadSheetAlignHorizontalCenter
action object are enabled only if the following conditions are met:
- Spreadsheet document edit operations are allowed (that is, the control’s OptionsBehavior.Editing property is set to
True
). - An in-place cell editor is inactive (the active worksheet’s IsEditing property returns
False
). - At least one cell is selected (the command is unavailable if a floating container is selected or the protected worksheet’s OptionsProtection.ActualAllowSelectUnlockedCells property returns
False
). - Cell formatting is allowed (the active worksheet’s OptionsProtection.ActualAllowFormatCells property returns
True
).
Note
To center the content between the top and bottom borders of all selected cells, use the AlignVerticalCenter command implemented as a TdxSpreadSheetAlignVerticalCenter action object.