TWorksheet

libwks.gif (976 bytes)This component is a simple descendant of TDrawGrid. Like TPlot component it can display and edit data from associated TContainer.

public members

Method procedure UpdateSize

This method updates column and row numbers. You should call it when you add or delete data elements in container.

Method procedure CopyToClipBoard(UseTabs: boolean)
Method procedure PasteFromClipBoard(InsertLines,Overwrite: boolean)
Method procedure Delete
Method procedure SelectAll

This group of methods should be used to edit data in container and works like in ordinary worksheet processor. Two clipboard data formats are supported: CF_TEXT and special TRealData, because when you frequently transfer data through clipboard in text format rounding errors may accumulate. TRealData format doesn't add any rounding errors. PasteFromClipBoard() method inserts data from (selection.top, selection.left) point or Col,Row point depend on conditional compilation. This method use TRealData format first (if available).

Method procedure AlignTextOut(ARect: TRect; ss: string)

This method should be called only from OnDrawCell event handler, for example, when you want to draw additional text in column/row headers. It uses AlignRight property for text alignment.

published members

Property property Container: TContainer

Points to associated TContainer component. You can load data into container at design-time and then assign this property to display data from container.

Property property BlockColorF: TColor
Property property BlockColorB: TColor

These colors used to draw selected cells

Property property AlignRight: boolean

If you set this property to true, text in cells will be aligned by right cell side.

Property property DrawHeaders: boolean
Property property Header: TStrings

TWorksheet can automatically display headers in fixed (nonscrollable) grid area: for columns (array of strings stored in Header property) and for rows (simply row numbers). You may also add more fixed rows/columns to draw your own information.

Note that apart from "block" editing commands operating with clipboard and selection, TWorksheet have inplace editing capabilities: if appropriate option flag is set, you may use cell editor, add lines (Shift+Ins), delete lines (Shift+Del) and cells (Alt+Del).

Other properties are inherited from parent class. Change published properties in Object Inspector and see results. See also description of IDMWorksheet interface and library demonstration sample (wksdemo.dpr) for additional information.