Unit 'csvdocument' Package
[Overview][Types][Classes][Index] [#fcl]

TCSVDocument

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Class representing a CSV document in memory.

Declaration

Source position: csvdocument.pp line 69

type TCSVDocument = class(TCSVHandler)

public

  constructor Create; override;

  

Create a new instance of TCSVDocument.

  destructor Destroy; override;

  

Remove the TCSVDocument instance from memory.

  procedure LoadFromFile();

  

Load a CSV file into the document.

  procedure LoadFromStream();

  

Load CSV data from a stream.

  procedure SaveToFile();

  

Save to file on disk.

  procedure SaveToStream();

  

Save the CSV data to stream.

  procedure AddRow();

  

Add a new row to the CSV Data.

  procedure AddCell();

  

Add a new cell to a row.

  procedure InsertRow();

  

Insert row before row number aRow.

  procedure InsertCell();

  

Insert cell at specified position.

  procedure RemoveRow();

  

Remove a row.

  procedure RemoveCell();

  

Remove a cell at a particular row.

  function HasRow();

  

Test if a row exists.

  function HasCell();

  

Test if a cell exists.

  function IndexOfCol();

  

Test whether a value exists at a given row.

  function IndexOfRow();

  

Test whether a value exists at a given column.

  procedure Clear;

  

Remove all rows.

  procedure CloneRow();

  

Duplicate a row.

  procedure ExchangeRows();

  

Exchange positions of 2 rows.

  procedure UnifyEmbeddedLineEndings;

  

Ensures all values have the same line ending/.

  procedure RemoveTrailingEmptyCells;

  

Remove empty cells at the end of each row.

  property DetectBOM: Boolean; [rw]

  property Cells []: string; default; [rw]

  

Array access to all cells.

  property RowCount: Integer; [r]

  

Number of available rows.

  property ColCount []: Integer; [r]

  

Return the column count for a given row.

  property MaxColCount: Integer; [r]

  

Maximum column count.

  property CSVText: string; [rw]

  

Return the CSV Document as a single CSV text.

end;

Inheritance

TCSVDocument

  

Class representing a CSV document in memory.

|

TCSVHandler

  

Base class for CSV reading and writing classes.

|

TPersistent

|

TObject,IFPObserved

Description

TCSVDocument can be used to read a CSV file in memory using e.g. LoadFromFile, manipulate the contents using the Cells property. Additional rows can be added using AddRow, additional cells can be added using AddCell. After all is done, the SaveToFile method can be used to save the new content to file. The various properties introduced in csvreadwrite.TCSVHandler can be used to configure the format of the CSV file.

See also

LoadFromFile

  

Load a CSV file into the document.

Cells

  

Array access to all cells.

AddRow

  

Add a new row to the CSV Data.

AddCell

  

Add a new cell to a row.

SaveToFile

  

Save to file on disk.

csvreadwrite.TCSVHandler

  

Base class for CSV reading and writing classes.


Documentation generated on: Nov 22 2024