Sign in Join
FPDoc Onlineexperiment

TCSVDocument class

In unit CsvDocument

Class representing a CSV document in memory.

Declaration

pascal
TCSVDocument = class(TCSVHandler)

Inheritance

  1. TCSVDocument
  2. TCSVHandler
  3. TPersistent
  4. TObject

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 TCSVHandler can be used to configure the format of the CSV file.

See also

Properties

DetectBOMpublic
CellspublicArray access to all cells.
RowCountpublicNumber of available rows.
ColCountpublicReturn the column count for a given row.
MaxColCountpublicMaximum column count.
CSVTextpublicReturn the CSV Document as a single CSV text.

Methods

CreatepublicCreate a new instance of TCSVDocument.
DestroypublicRemove the TCSVDocument instance from memory.
LoadFromFilepublicLoad a CSV file into the document.
LoadFromStreampublicLoad CSV data from a stream.
SaveToFilepublicSave to file on disk.
SaveToStreampublicSave the CSV data to stream.
AddRowpublicAdd a new row to the CSV Data.
AddCellpublicAdd a new cell to a row.
InsertRowpublicInsert row before row number aRow.
InsertCellpublicInsert cell at specified position.
RemoveRowpublicRemove a row.
RemoveCellpublicRemove a cell at a particular row.
HasRowpublicTest if a row exists.
HasCellpublicTest if a cell exists.
IndexOfColpublicTest whether a value exists at a given row.
IndexOfRowpublicTest whether a value exists at a given column.
ClearpublicRemove all rows.
CloneRowpublicDuplicate a row.
ExchangeRowspublicExchange positions of 2 rows.
UnifyEmbeddedLineEndingspublicEnsures all values have the same line ending/.
RemoveTrailingEmptyCellspublicRemove empty cells at the end of each row.

Inherited

From TCSVHandler (8)

Assign AssignCSVProperties Delimiter EqualColCountPerRow IgnoreOuterWhitespace LineEnding QuoteChar QuoteOuterWhitespace

From TPersistent (7)

AssignTo DefineProperties FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath GetOwner

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.