Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

jlink table.SetText (cell, lines);


jlink table.SetText (cell, lines);

So I wrote a java program to read some tables. However now I want it to
modify the tables to add text and parameters to specific tables using a
function like in the manual. like this:

writeTextInCell (theTable, 5, 2, "REV"); (for text
writeTextInCell (theTable, 5, 3, "&asm.mbr.PROI_REVISION"); (for
the parameter)

In the end, I run the script, a window pops up expecting me to click on a
table, I click on the table, two extra columns are added and the bottom
column is merged. However I get no text.

Anyone knows how to add text to a cell??




Here are the important parts on this complete breakfast:

currentModel = (Model2D) model;
tables = currentModel.ListTables();
TableCell cell1,cell2;
Table theTable = null;
String cellName;

SelectionOptions selops=null;
Selections sel = null;
selops = pfcSelect.SelectionOptions_Create("dwg_table");
selops.SetMaxNumSels(new Integer(1));
sel = session.Select(selops,null);
theTable = (Table)sel.get(0).GetSelItem();
writeLog("Found table in drawing with
"+String.valueOf(theTable.GetColumnCount())+" columns and
"+String.valueOf(theTable.GetRowCount())+" rows");

theTable.InsertColumn(5, 4, false);
theTable.InsertColumn(15, 5, false);
theTable.MergeRegion (pfcTable.TableCell_Create(1,1),
pfcTable.TableCell_Create(1,6), false);
writeTextInCell (theTable, 5, 2, "REV");
writeTextInCell (theTable, 5, 3, "&asm.mbr.PROI_REVISION");
writeTextInCell (theTable, 6, 2, "RELEASE LEVEL");
writeTextInCell (theTable, 6, 3, "&asm.mbr.PROI_REVISION");
writeTextInCell (theTable, 7, 3, "test");

FUNCTION : writeTextInCell()
PURPOSE : Utility to add one text line to a table cell
private static void writeTextInCell(Table table, int row,
int col, String text)
throws com.ptc.cipjava.jxthrowable
TableCell cell = pfcTable.TableCell_Create (row, col);
stringseq lines = stringseq.create();
lines.insert (0, text);
table.SetText (cell, lines);
Top Tags