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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

jlink table.SetText (cell, lines);

amedina
1-Newbie

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??

thanks

regards

Alfonso


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);
sel.get(0).UnHighlight();
theTable = (Table)sel.get(0).GetSelItem();
writeLog("Found table in drawing with
"+String.valueOf(theTable.GetColumnCount())+" columns and
"+String.valueOf(theTable.GetRowCount())+" rows");
//break;
writeLog(model.GetFullName());

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");
theTable.Display();




/*====================================================================*\
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);
}
0 REPLIES 0
Top Tags