IZennoTable

Assembly: ZennoLab.InterfacesLibrary
Full name: ZennoLab.InterfacesLibrary.ProjectModel.IZennoTable


Represents the data of the table. Provides methods for editing.

This interface can be used in action OwnCode (C# or PHP) of ProjectMaker.

Properties

ContainsHeaderLine

Property

Gets or sets a value that indicates the first row is a header line.

ColCount

Property

Gets the number of columns actually contained in the table.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // get columns count
            int colCount = table.ColCount;
             
            // set rows separator
            table.ColSeparator = ":";
             
            // add row to table
            table.AddRow("one:two:three:four");
             
            // get columns count
            if (table.ColCount != colCount) return "Columns count was changed";
            return "Columns count wasn't changed";

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // get columns count
            $colCount = $table->ColCount;
             
            // set rows separator
            $table->ColSeparator = ":";
             
            // add row
            $table->AddRow("one:two:three:four");
             
            // get columns count
            if ($table->ColCount != $colCount) return "Columns count was changed";
            return "Columns count wasn't changed";

RowCount

Property

Gets the number of rows actually contained in the table.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // get rows count
            int rowsCount = table.RowCount;
             
            // add row
            table.AddRow("one:two:three:four");
             
            // get rows count
            if (table.RowCount != rowsCount) return "Rows count was changed";
            return "Rows count wasn't changed";

Example2

// get table by name "MyTable"
            IZennoTable table = project.Tables->get_Item("MyTable");
             
            // get rows count
            $rowsCount = $table->RowCount;
             
            // add row
            $table->AddRow("one:two:three:four");
             
            // get rows count
            if ($table->RowCount != $rowsCount) return "Rows count was changed";
            return "Rows count wasn't changed";

RowSeparator

Property

Gets or sets the string that separates the segments of the rows.

The separator can be regular expression. In this case IsRowSeparatorRegEx property should be “true”.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // set rows separator
            table.RowSeparator = ":";
             
            // add row
            table.AddRow("one:two:three:four");
             
            // return table string
            return table.ToString();

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // set rows separator
            $table->RowSeparator = ":";
             
            // add row
            $table->AddRow("one:two:three:four");
             
            // return table string
            return $table->ToString();

ColSeparator

Property

Gets or sets the string that separates the segments of the columns.

The separator can be regular expression. In this case IsColSeparatorRegEx property should be “true”.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // set rows separator
            table.ColSeparator = ":";
             
            // add row
            table.AddRow("one:two:three:four");
             
            // return columns count
            return table.ColCount;

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // set rows separator
            $table->ColSeparator = ":";
             
            // add row
            $table->AddRow("one:two:three:four");
             
            // return columns count
            return $table->ColCount;

CsvSeparator

Property

Gets or sets the string that separates the segments of the columns in .csv file.

The separator can be ”,” or ”;“.

TryParseType

Property

Gets or sets a settings that allow parse types from string value.

IsRowSeparatorRegEx

Property

Gets or sets a value that indicates the rows separator is a regular expression or not.

IsColSeparatorRegEx

Property

Gets or sets a value that indicates the columns separator is a regular expression or not.

IsCorrectDisplayInExcel

Property

Gets or sets a value that indicates the table is displayed correctly in an excel or not.

ColSeparatorType

Property

Gets or sets a value that indicates the columns separator type.

RowSeparatorType

Property

Gets or sets a value that indicates the rows separator type.

Methods

GetCell

Method

Gets a value from a cell by column name.

Parameters

ПараметрОписание
columnThe name of column.
rowType : System.Int32 The cell’s row, zero-based index.

Returns: Value of the requested cell.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // get cell value from column "A" in the zero line
            string cell = table.GetCell("A", 0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // get cell value from column "A" in the zero line
            $cell = $table->GetCell("A", 0);

GetRow

Method

Returns the value of the row at the specified index from IZennoTable object as System.Collections.Generic.IEnumerable object.

Parameters

ПараметрОписание
rowThe zero-based index of the row.

Returns: A collection that contains the strings from the specified row.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // get row
            string row = String.Join(":", table.GetRow(0));
             
            // show message
            System.Windows.Forms.MessageBox.Show(row, "Row from table");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // get row
            $row = String::Join(":", $table->GetRow(0));
             
            // show message
            System\Windows\Forms\MessageBox::Show($row, "Row from table");

SetCell

Method

Sets a value into a cell by name.

Parameters

ПараметрОписание
columnThe name of column.
rowThe cell’s row, zero-based index.
valueThe value for the cell being set.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // set value into cell
            table.SetCell("A", 0, "value");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // set value into cell
            $table->SetCell("A", 0, "value");

GetCell

Method

Gets a value from a cell by column index.

Parameters

ПараметрОписание
rowType : System.Int32 The cell’s row, zero-based index.
columnType : System.Int32 The index of column.

Returns: Value of the requested cell.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // get cell value from column "0" in the zero line
            string cell = table.GetCell(0, 0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // get cell value from column "0" in the zero line
            $cell = $table->GetCell(0, 0);

SetCell

Method

Sets a value into a cell by index.

Parameters

ПараметрОписание
rowThe cell’s row, zero-based index.
columnThe index of column.
valueThe value for the cell being set.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // set value into cell
            table.SetCell(0, 0, "value");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // set value into cell
            $table->SetCell(0, 0, "value");

SetCellStyle

Method

Sets style for excel cell.

Parameters

ПараметрОписание
rowThe cell’s row, zero-based index.
columnThe cell’s column, zero-based index.
styleThe style for excel cell.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
             
            // create style
            var style = new ZennoTableStyle
            {
                HorizontalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.HorizontalAlignment.Right,
                VerticalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.VerticalAlignment.Bottom,
                Font = new Font("Comic Sans MS", 20, FontStyle.Italic | FontStyle.Underline, GraphicsUnit.Point),
                FontColor = Color.Red
            };
            style.SetBorder(InterfacesLibrary.Enums.Table.ExcelStyle.Borders.Right | InterfacesLibrary.Enums.Table.ExcelStyle.Borders.DiagonalUp, Color.Blue, InterfacesLibrary.Enums.Table.ExcelStyle.LineStyle.DashDot);
            
            // set style
            table.SetCellStyle(0, 0, style);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // create style
            $style = new ZennoTableStyle;
            $style->HorizontalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::HorizontalAlignment->Right;
            $style->VerticalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::VerticalAlignment->Bottom;
            $style->Font = new Font("Comic Sans MS", 20, FontStyle->Italic | FontStyle->Underline, GraphicsUnit->Point);
            $style->FontColor = Color->Red;
            style->SetBorder(InterfacesLibrary::Enums::Table::ExcelStyle::Borders->Right | InterfacesLibrary::Enums::Table::ExcelStyle::Borders->DiagonalUp, Color->Blue, InterfacesLibrary::Enums::Table::ExcelStyle::LineStyle->DashDot);
            
            // set style
            $table->SetCellStyle(0, 0, $style);

SetRowStyle

Method

Sets style for excel row.

Parameters

ПараметрОписание
rowThe cell’s row, zero-based index.
styleThe style for excel row.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
             
            // create style
            var style = new ZennoTableStyle
            {
                HorizontalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.HorizontalAlignment.Right,
                VerticalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.VerticalAlignment.Bottom,
                Font = new Font("Comic Sans MS", 20, FontStyle.Italic | FontStyle.Underline, GraphicsUnit.Point),
                FontColor = Color.Red
            };
            style.SetBorder(InterfacesLibrary.Enums.Table.ExcelStyle.Borders.Right | InterfacesLibrary.Enums.Table.ExcelStyle.Borders.DiagonalUp, Color.Blue, InterfacesLibrary.Enums.Table.ExcelStyle.LineStyle.DashDot);
            
            // set style
            table.SetRowStyle(0, style);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // create style
            $style = new ZennoTableStyle;
            $style->HorizontalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::HorizontalAlignment->Right;
            $style->VerticalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::VerticalAlignment->Bottom;
            $style->Font = new Font("Comic Sans MS", 20, FontStyle->Italic | FontStyle->Underline, GraphicsUnit->Point);
            $style->FontColor = Color->Red;
            style->SetBorder(InterfacesLibrary::Enums::Table::ExcelStyle::Borders->Right | InterfacesLibrary::Enums::Table::ExcelStyle::Borders->DiagonalUp, Color->Blue, InterfacesLibrary::Enums::Table::ExcelStyle::LineStyle->DashDot);
            
            // set style
            $table->SetRowStyle(0, $style);

SetColumnStyle

Method

Sets style for excel column.

Parameters

ПараметрОписание
columnThe cell’s column, zero-based index.
styleThe style for excel column.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
             
            // create style
            var style = new ZennoTableStyle
            {
                HorizontalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.HorizontalAlignment.Right,
                VerticalAlignment = InterfacesLibrary.Enums.Table.ExcelStyle.VerticalAlignment.Bottom,
                Font = new Font("Comic Sans MS", 20, FontStyle.Italic | FontStyle.Underline, GraphicsUnit.Point),
                FontColor = Color.Red
            };
            style.SetBorder(InterfacesLibrary.Enums.Table.ExcelStyle.Borders.Right | InterfacesLibrary.Enums.Table.ExcelStyle.Borders.DiagonalUp, Color.Blue, InterfacesLibrary.Enums.Table.ExcelStyle.LineStyle.DashDot);
            
            // set style
            table.SetColumnStyle(0, style);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // create style
            $style = new ZennoTableStyle;
            $style->HorizontalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::HorizontalAlignment->Right;
            $style->VerticalAlignment = InterfacesLibrary::Enums::Table::ExcelStyle::VerticalAlignment->Bottom;
            $style->Font = new Font("Comic Sans MS", 20, FontStyle->Italic | FontStyle->Underline, GraphicsUnit->Point);
            $style->FontColor = Color->Red;
            style->SetBorder(InterfacesLibrary::Enums::Table::ExcelStyle::Borders->Right | InterfacesLibrary::Enums::Table::ExcelStyle::Borders->DiagonalUp, Color->Blue, InterfacesLibrary::Enums::Table::ExcelStyle::LineStyle->DashDot);
            
            // set style
            $table->SetColumnStyle(0, $style);

GetCellStyle

Method

Get excel cell style.

Parameters

ПараметрОписание
rowThe cell’s row, zero-based index.
columnThe cell’s column, zero-based index.

Returns: Cell style.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
            var style = table.GetCellStyle(0,0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
            $style = $table->GetCellStyle(0, 0);

GetRowStyle

Method

Get excel row style.

Parameters

ПараметрОписание
rowThe cell’s row, zero-based index.

Returns: Cell style.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
            var style = table.GetRowStyle(0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
            $style = $table->GetRowStyle(0);

GetColumnStyle

Method

Get excel column style.

Parameters

ПараметрОписание
columnThe cell’s column, zero-based index.

Returns: Cell style.

Example

// get table by name "MyTable"
            var table = project.Tables["MyTable"];
            var style = table.GetColumnStyle(0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
            $style = $table->GetColumnStyle(0);

AddRow

Method

Adds a row to the end of the object of IZennoTable interface .

If rows separator wasn’t set then will be using separator by default.

Parameters

ПараметрОписание
rowA string of items created through a specified separator. If this string has a special format, for example file of Excel, the values ​should be separated by semicolons.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // set row separator
            table.ColSeparator = ":";
             
            // add row 
            table.AddRow("one:two:three:four");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // set row separator
            $table->ColSeparator = ":";
             
            // add row 
            $table->AddRow("one:two:three:four");

AddRow

Method

Adds a row from a list of values to the end of the object of IZennoTable interface .

Parameters

ПараметрОписание
valuesThe values of the row.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // add row 
            table.AddRow(new [] { "one", "two", "three", "four" });

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // add row 
            $table->AddRow(array("one", "two", "three", "four"));

DeleteRow

Method

Removes the row at the specified index of the IZennoTable object.

Parameters

ПараметрОписание
rowNumberThe zero-based index of the row to remove.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove row 
            table.DeleteRow(0);
             
            // if any row exist then remove row by index "0"
            if (project.Tables["MyTable"].RowCount > 0) project.Tables["MyTable"].DeleteRow(0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove row 
            $table->DeleteRow(0);
             
            // if any row exist then remove row by index "0"
            if ($project->Tables-get_Item("MyTable")->RowCount > 0) $project->Tables->get_Item("MyTable")->DeleteRow(0);

DeleteColumn

Method

Removes the column at the specified index of the IZennoTable object.

Parameters

ПараметрОписание
columnNumberThe zero-based index of the row to remove.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove row 
            table.DeleteColumn(0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove row 
            $table->DeleteColumn(0);

DeleteColumn

Method

Removes the column at the specified name (A, B, C…) of the IZennoTable object.

Parameters

ПараметрОписание
columnNameThe row name (A, B, C…).

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove row 
            table.DeleteColumn("A");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove row 
            $table->DeleteColumn("A");

GetColumn

Method

Gets the column values as a list at the specified column name (A, B, C…) of the IZennoTable object.

Parameters

ПараметрОписание
columnNameThe row name (A, B, C…).

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove row 
            var result = table.GetColumn("A");

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove row 
            $result = $table->GetColumn("A");

GetColumn

Method

Gets the column values as a list at the specified index of the IZennoTable object.

Parameters

ПараметрОписание
columnNumberThe zero-based index of the row to remove.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove row 
            var result = table.GetColumn(0);

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove row 
            $result = $table->GetColumn(0);

DeleteRow

Method

Removes the rows at the specified indices from collection of the IZennoTable object.

Parameters

ПараметрОписание
rowsThe specified indices of rows.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // remove rows 
            table.DeleteRow(new [] { 0, 1, 5, 7 });

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // remove rows 
            $table->DeleteRow(array(0, 1, 5, 7));

ToString

Method

Returns a string that represents the current table.

The ToString method for represents the rows and columns in string uses ColSeparator and RowSeparator properties.

Returns: A string that represents the current table.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // convert table to string  
            string str = project.ToString();

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // convert table to string  
            $str = $project->ToString();

Clear

Method

Removes all elements from the table.

Example

// clear the table 1
            project.Tables["Table 1"].Clear();

Example2

// clear the table 1
            $project->Tables->get_Item("Table 1")->Clear();

Bind

Method

Binds the specified file to current table.

Parameters

ПараметрОписание
filenameThe file name for bind data.

Example

// get the table
            IZennoTable table = project.Tables["Table 1"];
            // bind the file
            table.Bind("C:\\mytable.txt");

Example2

// get the table
            $table = $project->Tables->get_Item("Table 1");
            // bind the file
            $table->Bind("C:\\mytable.txt");

GetColumnsNames

Method

GetItem

Method

Gets the first row from the table satisfies the filter.

Parameters

ПараметрОписание
filterThe filter of range.
removeItemtrue if need to remove the row, otherwise and default false.

Returns: The requried row of table, or null, if the row is not found.

Example

// gets random row from several ranges of the table
            return string.Join(";", project.Tables["Table 1"].GetItem("random1(1,12-15,35-end)"));

Example2

// gets random item from several ranges of the list
            return String::Join(";", $project->Tables->get_Item("Table 1")->GetItem("random1(1,12-15,35-end)"));

GetItems

Method

Gets rows from the table satisfies the filter.

Parameters

ПараметрОписание
filterThe filter of range.
removeItemstrue if need to remove the rows, otherwise and default false.

Returns: The collection of requried rows.

Example

// gets 20 random rows from several ranges of the table
            var rows = project.Tables["Table 1"].GetItems("random20(1,12-15,35-end)");

Example2

// gets 20 random rows from several ranges of the table
            $rows = $project->Tables->get_Item("Table 1")->GetItems("random20(1,12-15,35-end)");

Reload

Method

Forcibly updates spreadsheet data. In case of error table does not changing. Supports only Google spreadsheets. Spends requests limit.

Returns: Returns true if spreadsheet data has been successfully reloaded The following code example demonstrates the