Sets the width of the cells in the specified column.
Syntax: |
---|
DlxTable.SetCellWidthFactor(array) DlxTable.SetCellWidthFactor(column, width) |
Parameters
Parameter | Description |
---|---|
array | A numeric array with the row widths. The widths values must be between 0 and 1 and are relative to the width of the table. |
column | Column index. |
width | Cell width. The value is between 0 and 1 and is relative to the width 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 %.2f", table.GetCellWidthFactor(0), table.GetCellWidthFactor(1),
table.GetCellWidthFactor(2), table.GetCellWidthFactor(3), table.GetCellWidthFactor(4));
var h = new Array();
h[0] = 0.4;
h[1] = 0.2;
h[2] = 0.2;
h[3] = 0.1;
h[3] = 0.1;
table.SetCellHeightFactor(h);
var dlg = new DlxDialog(400, 160, "Table");
if (dlg.IsValid())
{
dlg.AddStaticText(10, 33, 70, "Column ");
dlg.AddStaticText(10, 58, 70, "Width: ");
var ctrl_i = dlg.AddEditNumber(90, 30, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, 0, 0, 4);
var ctrl_s = dlg.AddEditNumber(90, 55, 300, DlxApp.DIALOGEDITNUMBER_LENGTH, table.GetCellWidthFactor(0), 0.1, 0.9);
dlg.AddOkButton(280, 120, 50, 25);
dlg.AddCancelButton(340, 120, 50, 25);
if (dlg.DoModal())
{
table.SetCellWidthFactor(ctrl_i.GetInt(), ctrl_s.GetNumber());
}
}
}
}
}
|