TableCreateΒΆ
TableCreate create a new table object.
-
hTable = TableCreate()
-
hTable = TableCreate(hTableOther)
-
hTable = TableCreate(nColumns, nRows)
-
hTable = TableCreate(smText)
Return Value
hTable. hTable is the handle of the new table object or 0 if the obejct cannot be created.
Parameters
-
hTableOther
If hTableOther is a valid table object handle the functions creates a new object as a copy of the given object. If hTableOther is set to 0 a table object with default settings is created.
-
nColumns
nRows is the number of columns.
-
nRows
nRows is the number of rows.
-
smText
smText is a string matrix. The number of rows is limited to 100 and the number of columns is limited to 50.
Example
def test_1_TableCreate()
{
s = "[[
Test No.:;; E-Pump Type:;
Cyl. Header:;; FB-Place:;
]]"
<dummy1, sm, dummy2> = StringToField(s, ";")
sm = sm[2:nr(sm)-1;]
sm = strtrim(sm);
hDoc = DocCreate();
hPage = PageCreate();
DocAddPage(hDoc, hPage);
hLayer = PageGetAllLayers(hPage);
hTable = TableCreate(sm);
rmAttrib = TableGetAttrib(hTable);
rmAttrib = rmAttrib | (TABLE_AUTOSIZE_WIDTH | TABLE_AUTOSIZE_HEIGHT);
TableSetAttrib(hTable, rmAttrib);
LayerAddObjects(hLayer, hTable);
PageReplot(hPage);
}
test_1_TableCreate()
def test_2_TableCreate()
{
s = "[[
Test No.:;; E-Pump Type:;
Cyl. Header:;; FB-Place:;
]]"
<dummy1, sm, dummy2> = StringToField(s, ";")
sm = sm[2:nr(sm)-1;]
sm = strtrim(sm);
smName = [strempty(nr(sm), 1), sm]
smName = smName[;1:nc(sm)]
smName = "$" + smName + "$";
smName = strfindreplace(smName, "$$", "");
hDoc = DocCreate();
hPage = PageCreate();
DocAddPage(hDoc, hPage);
hLayer = PageGetAllLayers(hPage);
hTable = TableCreate(sm);
rmAttrib = TableGetAttrib(hTable);
rmAttrib = rmAttrib | (TABLE_AUTOSIZE_WIDTH | TABLE_AUTOSIZE_HEIGHT);
TableSetAttrib(hTable, rmAttrib);
TableSetName(hTable, smName, [1,1, nc(smName), nr(smName)]);
TableUsePlaceholderDialog(hTable, 1)
LayerAddObjects(hLayer, hTable);
PageReplot(hPage);
}
test_2_TableCreate()
def test_3_TableCreate()
{
s = "[[
Test No.:;; E-Pump Type:;
Cyl. Header:;; FB-Place:;
]]"
<dummy1, sm, dummy2> = StringToField(s, ";")
sm = sm[2:nr(sm)-1;]
sm = strtrim(sm);
smName = [strempty(nr(sm), 1), sm]
smName = smName[;1:nc(sm)]
smName2 = smName';
sm2 = sm';
for (i in 1:nc(sm)) {
for (j in 1:nr(sm)) {
sm2[i;nc(sm2)-j+1] = sm[j;i]
smName2[i;nc(sm2)-j+1] = smName[j;i]
if (smName2[i;nc(sm2)-j+1] != "") {
smName2[i;nc(sm2)-j+1] = "$" + smName2[i;nc(sm2)-j+1] + "$";
}
}
}
hDoc = DocCreate();
hPage = PageCreate();
DocAddPage(hDoc, hPage);
hLayer = PageGetAllLayers(hPage);
hTable = TableCreate(sm2);
TableSetTextAngle(hTable, zeros(size(sm2)) + 270);
rmAttrib = TableGetAttrib(hTable);
rmAttrib = rmAttrib | (TABLE_AUTOSIZE_WIDTH | TABLE_AUTOSIZE_HEIGHT);
TableSetAttrib(hTable, rmAttrib);
TableSetName(hTable, smName2, [1,1, nc(smName2), nr(smName2)]);
TableUsePlaceholderDialog(hTable, 1)
LayerAddObjects(hLayer, hTable);
PageReplot(hPage);
}
test_3_TableCreate()
History
Version | Description |
---|---|
5.7.0 | hTableOther can be set to 0. |
4.2.7 | Function can be invoked with one parameter (copy constructor). |
See also
id-1827292