Skip to main content
Participant
September 10, 2026
Question

Custom table header

  • September 10, 2026
  • 5 replies
  • 53 views

I have a table with a dark color heading row and body rows that are light colors. I want to use a white column separator in the heading row and black column separators for the body rows. How do I create a table style that does this automatically?

    5 replies

    frameexpert
    Community Expert
    Community Expert
    September 13, 2026

    Here is a script that you can run on a selected table; you only need your cursor anywhere in the table. It will prompt you for one of the document’s Ruling Formats. When you select one, it will apply it to the table row’s column separators.

    main ();

    function main () {

    var doc, tbl;

    // Test for an active document.
    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
    // Make sure the cursor is in the table,
    // or one or more cells are selected.
    tbl = doc.SelectedTbl;
    if (tbl.ObjectValid () === 1) {
    processDoc (doc, tbl);
    }
    }
    }

    function processDoc (doc, tbl) {

    var rulingFmts, index;

    // Get the document's ruling formats.
    rulingFmts = getRulingFmts (doc);

    // Prompt the user with the document's ruling formats.
    index = ScrollBox ("Please choose the Ruling Format:",
    getStringsFromArray (rulingFmts.names));
    if (index !== null) {
    // Apply the selected ruling format to the heading columns.
    processTbl (rulingFmts.objects[index], tbl, doc);
    }
    }

    function processTbl (rulingFmt, tbl, doc) {

    var row, cell;

    if (app.Displaying === 1) {
    app.Displaying = 0;
    }

    // Loop through the table's heading rows.
    row = tbl.FirstRowInTbl;
    while (row.RowType === Constants.FV_ROW_HEADING) {
    // Process each cell.
    cell = row.FirstCellInRow;
    while ((cell.ObjectValid () === 1) &&
    (cell.NextCellInRow.ObjectValid () === 1)) {
    applyColumnRuling (cell, rulingFmt);
    cell = cell.NextCellInRow;
    }
    row = row.NextRowInTbl;
    }

    if (app.Displaying === 0) {
    app.Displaying = 1;
    doc.Redisplay ();
    }
    }

    function applyColumnRuling (cell, rulingFmt) {

    cell.CellOverrideRightRuling = rulingFmt;
    cell.CellUseOverrideRRuling = 1;
    }

    function getRulingFmts (doc) {

    var rulingFmts, fmt;

    rulingFmts = {objects: [], names: []};

    fmt = doc.FirstRulingFmtInDoc;
    while (fmt.ObjectValid () === 1) {
    rulingFmts.objects.push (fmt);
    rulingFmts.names.push (fmt.Name);
    fmt = fmt.NextRulingFmtInDoc;
    }

    return rulingFmts;
    }

    function getStringsFromArray (array) {

    // Convert an array into a list of Strings.

    var count, i, strings;

    strings = new Strings ();
    count = array.length;
    for (i = 0; i < count; i += 1) {
    strings.push (array[i]);
    }

    return strings;
    }

     

    www.frameexpert.com
    frameexpert
    Community Expert
    Community Expert
    September 13, 2026

    Here is a link to a 5-minute video demonstrating the script:

     

    www.frameexpert.com
    Barb Binder
    Community Expert
    Community Expert
    September 12, 2026

    Unfortunately, you can't accomplish this with a table style natively in FrameMaker. You will need to create a ruling style set to white, and apply it via Custom Ruling and Shading.

    If you have a lot of tables, this is a lot of work but ​@frameexpert can likely help you automate it with a script. 

    ~Barb at Rocky Mountain Training
    Bob_Niland
    Community Expert
    Community Expert
    September 12, 2026

    Because it’s possible create such a Table via Custom, but not save it as a named Style…

    … you could create a super-set template table on a Reference Page, then copy&paste it onto Body pages where needed. Delete unneeded rows & columns after populating.

    frameexpert
    Community Expert
    Community Expert
    September 11, 2026

    Can you post a screenshot? Thank you.

    www.frameexpert.com