Skip to main content
Gene Sorg
Participant
Jul 23, 2019 3:18 PM UTC
Answered

How does one change a tables title to something meaningful

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 is closed to new replies. Start a new post to keep the conversation going.
frameexpert
frameexpertCorrect answer
Community Expert
Jul 23, 2019 3:45 PM UTC

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

3 replies

frameexpert
Community Expert
Community Expert
Jul 23, 2019 3:47 PM UTC

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.

Translate
www.frameexpert.com
frameexpert
Community Expert
Community Expert
Jul 23, 2019 3:48 PM UTC

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

Translate
www.frameexpert.com
frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
Jul 23, 2019 3:45 PM UTC

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");

Translate
www.frameexpert.com