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());
}
}
}
}
}
|