Skip to main content
12-Amethyst
July 11, 2024
Solved

Weblink (CreoJS) Table.SetText Not Working

  • July 11, 2024
  • 1 reply
  • 999 views

Has anyone had luck with table.settext?  For me it's breaking and a try/catch isn't throwing the error message.  The table is generating up to this point.

I know it's breaking because if I moved the mergeregion after the settext, that doesn't work, and the rest of my code isn't running either.

Any help would be appreciated!  Thanks!

var dwgTable = drawing.CreateTable (tabinstrs);

var topLeft = pfcCreate ("pfcTableCell").Create (1, 1);
var bottomRight = pfcCreate ("pfcTableCell").Create (1, 5);
dwgTable.MergeRegion (topLeft, bottomRight, null);

try {
dwgTable.SetText(1, , "CONN NAME PART NUMBER");
} catch (err) {
  alert("Error setting text in table cell");
}
Best answer by AH_10565398

I resolved this myself.  I found the writetextincell function from the JS example.

function writeTextInCell(table /* pfcTable */, row /* integer */,
  col /* integer */, text /* string */)
{
var cell = pfcCreate ("pfcTableCell").Create (row, col);
var lines = pfcCreate ("stringseq");
lines.Append (text);
table.SetText (cell, lines);
}

1 reply

AH_1056539812-AmethystAuthorAnswer
12-Amethyst
July 11, 2024

I resolved this myself.  I found the writetextincell function from the JS example.

function writeTextInCell(table /* pfcTable */, row /* integer */,
  col /* integer */, text /* string */)
{
var cell = pfcCreate ("pfcTableCell").Create (row, col);
var lines = pfcCreate ("stringseq");
lines.Append (text);
table.SetText (cell, lines);
}