CreateTableShape: IWxTableShape;
CreateTableShape(): Prognoz.Platform.Interop.Andy.IWxTableShape;
The CreateTableShape method creates a table shape.
On executing the method a new shape containing a table is created. By default, the table consists of three columns and one row. Their number can be changed if required, using the AddColumnWithFixedWidth or AddRowWithFixedHeight methods.
Executing the example requires a form with the Button1 button, the WorkspaceBox component and the UiWorkspace component named UiWorkspace1, which is a data source for WorkspaceBox.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
w: IWxWorkspace;
TShape: IWxTableShape;
TSheet: ITabSheet;
Cell: ITabRange;
i, j: Integer;
Begin
w := UiWorkspace1.WxWorkspace;
//Create a new table shape
TShape := w.CreateTableShape;
TShape.Size := New GxSizeF.Create(50, 40);
TShape.BeginUpdate;
//Set up table
TSheet := TShape.TabSheet;
For i := 0 To 2 Do
For j := 0 To 2 Do
Cell := TSheet.Cell(i, j);
Cell.Value := ...;//Values of cells
Cell.Style.BorderStyle(TabBorder.Outline) := TabBorderStyle.Continuous;
End For;
End For;
//Create another column
TShape.AddColumnWithFixedWidth(20);
TShape.AddRowWithFixedHeight(20);
//Specify values for cells of the created column
TSheet.Cell(0, 3).Value := "Error";
TSheet.Cell(3, 0).Value := "Total";
TShape.AdjustSize;
TShape.EndUpdate;
End Sub Button1OnClick;
A new table shape is created on clicking the button. Values are specified for the cells of the table. Also, an additional column and one row are created in the table.
Executing this example requires a .NET form with the Button1 button, the WorkspaceBoxNet component, and the UiWorkspaceNet component named UiWorkspaceNet1, which is used as a data source for WorkspaceBoxNet.
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Tab;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
w: IWxWorkspace;
TShape: IWxTableShape;
GxSizeFCls: GxSizeFClass = New GxSizeFClass();
TSheet: ITabSheet;
Cell: ITabRange;
i, j: Integer;
Begin
w := UiWorkspaceNet1.WxWorkspace;
//Create a new table shape
TShape := w.CreateTableShape();
GxSizeFCls.Create(50, 40);
TShape.Size := GxSizeFCls;
TShape.BeginUpdate();
//Set up table
TSheet := TShape.TabSheet;
For i := 0 To 2 Do
For j := 0 To 2 Do
Cell := TSheet.Cell[i, j];
Cell.Value := ...; //Values of cells
Cell.Style.BorderStyle[TabBorder.tbOutline] := TabBorderStyle.tbsContinuous;
End For;
End For;
//Create another column
TShape.AddColumnWithFixedWidth(20);
TShape.AddRowWithFixedHeight(20);
//Specify values for cells of the created column
TSheet.Cell[0, 3].Value := "Error";
TSheet.Cell[3, 0].Value := "Total";
TShape.AdjustSize();
TShape.EndUpdate();
End Sub;
A new table shape is created on clicking the button. Values are defined for the table cells. Also, an additional column and one row are created in the table.
See also: