How to set table.SetCellVAlign for selected cells and at cur
Posted: Wed Jan 26, 2011 1:55 am
1. How to set table.SetCellVAlign for selected cells and at the caret position?
2. How to select only the single cell at the caret position?
3. Is there a way to select one cell? I can select 2 cells but not one?
Code: Select all
procedure TFormMain.TableCellVAlignMiddle1Click( Sender: TObject );
var
Item: TCustomRVItemInfo;
Table: TRVTableItemInfo;
RichViewEdit: TCustomRichViewEdit;
ItemNo: integer;
r, c: integer;
tr, lc: integer;
sc, sr: integer;
RVData: TCustomRVFormattedData;
begin
if Assigned( AdvOfficePager1.ActivePage ) then
begin
cxTRichViewEdit := TcxTRichViewEdit( AdvOfficePager1.ActivePage.Controls[ 0 ] );
if not cxTRichViewEdit.InnerEditor.CanChange or not cxTRichViewEdit.InnerEditor.GetCurrentItemEx( TRVTableItemInfo,
RichViewEdit, Item ) then
exit;
Table := TRVTableItemInfo( Item );
ItemNo := RichViewEdit.GetItemNo( Table );
for r := 0 to table.Rows.Count - 1 do
for c := 0 to table.Rows[ r ].Count - 1 do
if table.Cells[ r, c ] <> nil then
if table.IsCellSelected( r, c ) then
begin
with table.Cells[ r, c ].VisibleBorders do
table.SetCellVAlign( rvcMiddle, r, c );
end
else
// not selected so SetCellVAlign at the caret position?
begin
end;
end;
end;
3. Is there a way to select one cell? I can select 2 cells but not one?