Skip to main content
Gene Sorg
Participant
July 23, 2019
Answered

How does one change a tables title to something meaningful

  • July 23, 2019
  • 2 replies
  • 388 views

Tables come up with a title of "Table 1:", how do I change that to be more meaningful like "Sale Projections by Region"?

  //Create the table

   var textLoc, tbl; 

    textLoc = new TextLoc (doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf, 0); 

    // NewTable(format, numCols, numBodyRows, numHeaderRows, numFooterRows, textLoc)

    tbl = doc.NewTable ("Format A", 4, 10, 1, 0, textLoc);

  //Change the table title from "Table 1:" to "Sale Projections by Region"

???

This topic has been closed for replies.
Correct answer frameexpert

The table title is like any other FrameMaker paragraph: it has a Paragraph Format applied to it. Typically, you would redefine the autonumber properties for the table's title paragraph format so that it matches what you want. In your case, you may just want to remove the autonumber and then add the correct text depending on the table's contents. For a table containing the cursor, here is how you add text to the table title.

#target framemaker

var doc, tbl, textLoc, pgf;

doc = app.ActiveDoc;

tbl = doc.SelectedTbl;

// Get the table's title paragraph.

pgf = tbl.FirstPgf;

// Make a TextLoc and add the desired title.

textLoc = new TextLoc (pgf, 0);

doc.AddText (textLoc, "Sale Projections by Region");

2 replies

frameexpert
Community Expert
Community Expert
July 23, 2019

Gene, if you are satisfied with my answers, please mark them as Correct. I answered some of your other questions, but you did not mark them as Correct. I would appreciate if you would. Thank you.

www.frameexpert.com
frameexpert
Community Expert
Community Expert
July 23, 2019

I am sorry about that. You marked it correct as I was posting my request. Thank you very much!

www.frameexpert.com
frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
July 23, 2019

The table title is like any other FrameMaker paragraph: it has a Paragraph Format applied to it. Typically, you would redefine the autonumber properties for the table's title paragraph format so that it matches what you want. In your case, you may just want to remove the autonumber and then add the correct text depending on the table's contents. For a table containing the cursor, here is how you add text to the table title.

#target framemaker

var doc, tbl, textLoc, pgf;

doc = app.ActiveDoc;

tbl = doc.SelectedTbl;

// Get the table's title paragraph.

pgf = tbl.FirstPgf;

// Make a TextLoc and add the desired title.

textLoc = new TextLoc (pgf, 0);

doc.AddText (textLoc, "Sale Projections by Region");

www.frameexpert.com