Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Shading straddled cells

$
0
0

I have a table with 10 columns and 2 body rows. Before the script is run, cell 1 in the first table row (which contains text) is straddled over all cells in the row (cells 1-10). My script so far deletes the second row then unstraddles the top row and restraddles it over cells 1-7, leaving 3 cells unstraddled (cells 8,9 & 10)

I then want to straddle these 3 cells together (straddle cell 8 over 8, 9 and 10) and shade them. Below is the script I have so far which gets me as far as selecting the three cells to be straddled and shaded. Is it possible to straddle and shade a selection? Also, would someone please advice me for future posts how I post as code just to keep things tidy?


Thanks

 

var doc = app.ActiveDoc;

var tbl = doc.SelectedTbl;

 

 

        //Delete Row

        var row = tbl.FirstRowInTbl.NextRowInTbl;

        row.Delete ()

      

        if(tbl.ObjectValid() == true)

    {

        alert("Row has been deleted");

    }

      

      

        // Remove and re-apply the straddle

       var header=tbl.FirstRowInTbl.FirstCellInRow;

       if (header.ObjectValid()) {

       header.UnStraddleCells(1, 10);

       header.StraddleCells(1, 7);

       alert("Station Header Restraddled.");

        }

      

        else

        {

          

        alert("No cells to unstraddle.");

      

        }

      

      

       //Select the three cells I want to shade

       tbl.MakeTblSelection (0, 0, 7, 9);

     

      //Apply Green shading to cells

     var pgf = doc.TextSelection.beg.obj;

     var cellsForShading = pgf.InTextObj;

 

      // Get the "PBgreen" color object.

     var color = doc.GetNamedColor ("PBGreen");

   

     // Set the cell's properties to 100% PBGreen.

     cellsForShading .CellOverrideShading = color;

     cellsForShading .CellUseOverrideShading = true;

     cellsForShading .CellOverrideFill = 0;

     cellsForShading .CellUseOverrideFill = true;

 

 

      

       {

        tbl = tbl.NextTblInDoc;

        }


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>