[Lazarus] In search of a component for holding a table of strings

Werner Pamler werner.pamler at freenet.de
Thu Dec 29 19:02:36 CET 2016


Am 29.12.2016 um 16:59 schrieb Bart via Lazarus:
> Hi,
>
> I am in need of a component/clas that can hold a 2 dimensional "table"
> of strings.
> The dimensions are unknown at designtime: I read the data from a HTML table.
> The HTML reader provides events that give me the data of each cell,
> and that  tell me whenever a row is started or closed.
>
> The class should be able to:
> - access individual "cellls" (read/write)
> - add or insert a row (with an without data (TStrings and Array of
> String must be supprted as the datatype)). Note: adding a row must be
> possible when the dimensions of the table are yet unknown.
> - upon adding a row, it should be able to extend the dimensions of the table
> - the strings itself may contain LineEndings
>
> Not needed right now, but nice to have:
> - add or insert a column (with an without data)
> - upon adding a column, it should be able to extend the dimensions of the table
> - delete a row or column
>
>
> I have no need for saving the table to disk in any way.
> The program that uses this class should not need external libraries,
> since I cannot install those on the target computer I need my program
> on.
>
> I botched up some class that can do this (good enough for my purposes,
> but it's not nice code), but I was wondering if there already is some
> component that is more suitable (and well tested) for this.
> Using some sort of in memory dataset comes to mind, but I never use
> databases in my programs at all, so I'm a complete novice on that
> topic.

fpspreadsheet? It even has a html reader, but might be an overkill 
though. Internally it uses a TAVLTree for storing the cells. This tree 
is extremely fast. Maybe you can build your class around it.

Or the TVirtualGrid from grids.pas which is used internally by 
TCustomGrid and its descendants?


More information about the Lazarus mailing list