Back to Devexpress

TdxSpreadSheetTableView.Columns Property

vcl-dxspreadsheetcore-dot-tdxspreadsheettableview-9243dbd5.md

latest3.4 KB
Original Source

TdxSpreadSheetTableView.Columns Property

Provides access to the column collection within the current Table View worksheet.

Declaration

delphi
property Columns: TdxSpreadSheetTableColumns read;

Property Value

Type
TdxSpreadSheetTableColumns

Remarks

Use this property to manage the collection of column objects in the Table View worksheet and customize the default width of columns.

Since the Columns property provides zero-based indexed access to individual elements of the collection, you can use it to customize any of the column objects you created earlier.

The following code example demonstrates how to use the Columns property to customize the style of a column and all cells within it.

delphi
//...
var
  ATableView: TdxSpreadSheetTableView;
  AColumn: TdxSpreadSheetTableColumn;
//...
  ATableView := TdxSpreadSheetTableView(dxSpreadSheet1.ActiveSheet);
  if(ATableView.Columns[2] = nil) then
    begin
      ATableView.Columns.CreateItem(2);
// Creating the column object for individual customization
    end;
// An indexed access to the third column in a Table View
  AColumn := ATableView.Columns[2];
  AColumn.Style.Borders[bLeft].Color := clBlue;
  AColumn.Style.Borders[bLeft].Style := sscbsMediumDashDotDot;
  AColumn.Style.Borders[bRight].Color := clBlue;
  AColumn.Style.Borders[bRight].Style := sscbsMediumDashDotDot;
  AColumn.Style.Brush.Style := sscfsRevDiagonalStrip;
  AColumn.Style.Brush.BackgroundColor := clHotLight;
  AColumn.Style.Brush.ForegroundColor := clSkyBlue;
cpp
//...
  TdxSpreadSheetTableView* ATableView;
  TdxSpreadSheetTableColumn* AColumn;
//...
  ATableView = static_cast<TdxSpreadSheetTableView*>(dxSpreadSheet1->ActiveSheet);
  if(ATableView->Columns->Items[2] == NULL)
  {
// Creating the column object for individual customization
    ATableView->Columns->CreateItem(2);
  }
// An indexed access to the third column in a Table View
  AColumn = ATableView->Columns->Items[2];
  AColumn->Style->Borders[bLeft]->Color = clBlue;
  AColumn->Style->Borders[bLeft]->Style = sscbsMediumDashDotDot;
  AColumn->Style->Borders[bRight]->Color = clBlue;
  AColumn->Style->Borders[bRight]->Style = sscbsMediumDashDotDot;
  AColumn->Style->Brush->Style = sscfsRevDiagonalStrip;
  AColumn->Style->Brush->BackgroundColor = clHotLight;
  AColumn->Style->Brush->ForegroundColor = clSkyBlue;

For additional information, refer to the Table Item Appearance Customization Level topic.

See Also

TdxSpreadSheetTableView.Rows

TdxSpreadSheetTableView Class

TdxSpreadSheetTableView Members

dxSpreadSheetCore Unit