Sets the height of the cells in the specified row.
Syntax: |
---|
DlxTable.SetCellHeightFactor(array) DlxTable.SetCellHeightFactor(row, height) |
Parameters
Parameter | Description |
---|---|
array | A numeric array with the row heights. The values of the heights must be between 0 and 1 and are relative to the height of the table. |
row | Row index. |
height | Cell height. The value is between 0 and 1 and is relative to the height of the table. |
Return Value
If the operation ends correctly it returns true otherwise it returns false.
Example
Copy code | |
---|---|
var prj = DlxApp.GetJob().GetProject("Example Sch");
if (!prj.IsValid())
prj = DlxApp.GetJob().NewProject("Example Sch");
var doc = prj.GetDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
if (!doc.IsValid())
{
doc = prj.NewDocument("Examples Sch", DlxApp.DOCTYPE_SCHEMATIC);
doc.SetPageFormat("A4", false);
}
if (doc.IsValid() && doc.Activate())
{
var page = doc.GetActivePage();
if (page.IsValid())
{
var layer = page.GetLayerFromType(DlxApp.LAYERTYPE_DRAWING);
if (layer.IsValid())
{
var table = layer.DrawTable(new DlxRect(50,40,160,90), 4, 5);
DlxApp.Printf("%.2f %.2f %.2f %.2f", table.GetCellHeightFactor(0), table.GetCellHeightFactor(1),
table.GetCellHeightFactor(2), table.GetCellHeightFactor(3));
var h = new Array();
h[0] = 0.5;
h[1] = 0.2;
h[2] = 0.2;
h[3] = 0.1;
table.SetCellHeightFactor(h);
var dlg = new DlxDialog(400, 160, "Table");
if (dlg.IsValid())
{
dlg.AddStaticText(10, 33, 70, "Row ");
dlg.AddStaticText(10, 58, 70, "Height: ");
var ctrl_i = dlg.AddEditNumber(90, 30, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, 0, 3);
var ctrl_s = dlg.AddEditNumber(90, 55, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, table.GetCellHeightFactor(0), 0.1, 0.9);
dlg.AddOkButton(280, 120, 50, 25);
dlg.AddCancelButton(340, 120, 50, 25);
if (dlg.DoModal())
{
table.SetCellHeightFactor(ctrl_i.GetInt(), ctrl_s.GetNumber());
}
}
}
}
}
|