GO2cam Javascript API  6.11
GO2SExcelFile Class Reference

Class to manage excel files. More...

Inherits QObject.

Public Member Functions

 GO2SExcelFile (String m_filepath, GO2SEnum::GO2SFileOpen mode=GO2SEnum::GO2SFileOpen::read_only)
 Open and load an excel file.
 
GO2SEnum::GO2SError AddSheet ()
 Create a new sheet at the last position and set it as current sheet.
 
void Close ()
 Close the file.
 
Number GetColumnCount ()
 
Number GetCurrentSheet ()
 
Number GetRowCount ()
 
Boolean IsOpen ()
 
Array< Array< String > > ReadArray ()
 Read the current sheet content.
 
Array< Array< String > > ReadArray (Number startRow, Number startCol, Number endRow, Number endCol)
 Read several cells between start (row,col) and an end (row,col), in the current sheet.
 
String ReadCell (Number row, Number col)
 Read a cell at coordinate on the current sheet.
 
Array< String > ReadColumn (Number col)
 Read a column in the current sheet.
 
Array< String > ReadRow (Number row)
 Read a row in the current sheet.
 
void Save ()
 Save the file.
 
GO2SEnum::GO2SError SetCurrentSheet (Number index)
 
GO2SEnum::GO2SError WriteCell (Number row, Number col, String newCell)
 Write a new content in a cell.
 
GO2SEnum::GO2SError WriteColumn (Number col, Array< String > newCells)
 Write a column in the current sheet.
 
GO2SEnum::GO2SError WriteRow (Number row, Array< String > newCells)
 Write a row in the current sheet.
 

Detailed Description

Class to manage excel files.

Attention
Microsoft Excel must be installed on the computer
Remarks
the first cell of the Excel file is at (1,1) not (0,0)

Constructor & Destructor Documentation

◆ GO2SExcelFile()

GO2SExcelFile::GO2SExcelFile ( String m_filepath,
GO2SEnum::GO2SFileOpen mode = GO2SEnum::GO2SFileOpen::read_only )

Open and load an excel file.

Parameters
[in]m_filepathfull path of the file (directory + name)
[in]modeopening mode

Member Function Documentation

◆ GetColumnCount()

Number GO2SExcelFile::GetColumnCount ( )
inline
Returns
the number of columns of the current sheet

◆ GetCurrentSheet()

Number GO2SExcelFile::GetCurrentSheet ( )
inline
Returns
the index of the current sheet

◆ GetRowCount()

Number GO2SExcelFile::GetRowCount ( )
inline
Returns
the number of rows of the current sheet

◆ IsOpen()

Boolean GO2SExcelFile::IsOpen ( )
inline
Returns
if the Excel file is properly open

◆ ReadCell()

String GO2SExcelFile::ReadCell ( Number row,
Number col )

Read a cell at coordinate on the current sheet.

Parameters
[in]rowrow of the cell to read
[in]colcolumn of the cell to read

◆ ReadColumn()

Array< String > GO2SExcelFile::ReadColumn ( Number col)

Read a column in the current sheet.

Parameters
[in]colcolumn to read

◆ ReadRow()

Array< String > GO2SExcelFile::ReadRow ( Number row)

Read a row in the current sheet.

Parameters
[in]rowrow to read

◆ SetCurrentSheet()

GO2SEnum::GO2SError GO2SExcelFile::SetCurrentSheet ( Number index)

Set the current sheet to another one at the given index

Remarks
the new current sheet must already exists
Parameters
[in]indexindex of the existing sheet to set as current

◆ WriteCell()

GO2SEnum::GO2SError GO2SExcelFile::WriteCell ( Number row,
Number col,
String newCell )

Write a new content in a cell.

Parameters
[in]rowrow of the cell to write
[in]colcolumn of the cell to write
[in]newCellnew content

◆ WriteColumn()

GO2SEnum::GO2SError GO2SExcelFile::WriteColumn ( Number col,
Array< String > newCells )

Write a column in the current sheet.

Parameters
[in]colcolumn to write
[in]newCellsnew column content

◆ WriteRow()

GO2SEnum::GO2SError GO2SExcelFile::WriteRow ( Number row,
Array< String > newCells )

Write a row in the current sheet.

Parameters
[in]rowrow to write
[in]newCellsnew row content