3 Replies Latest reply on Aug 14, 2017 6:30 AM by Ribnog

    Help with some questions about tables, colors and fonts

    Ribnog

      Hi,

       

      Please, to start see the simple code that I'm writing:

       

      var myDoc = app.activeDocument;
      var myTable = app.selection[0].convertToTable("\t", "\t", 2);  
        
      myTable.cells[0].properties = {
      contents: "TITLE",
      width: "4 mm",
      rotationAngle: 270,
      rightInset: 0.5, leftInset: 0.5, topInset: 2, bottomInset: 2,
      fillColor: "COLOR 2018",
      bottomEdgeStrokeColor: "COLOR 2018",
      topEdgeStrokeColor: "COLOR 2018",
      leftEdgeStrokeColor: "COLOR 2018",
      topEdgeStrokeWeight: 1,
      bottomEdgeStrokeWeight: 1,
      rightEdgeStrokeWeight: 0,
      leftEdgeStrokeWeight: 1,
      };
      
      myTable.cells[0].texts[0].properties = {justification: Justification.RIGHT_ALIGN, appliedFont: "Fira Sans", fillColor: "Paper"}; 
      
      myTable.cells[1].properties = {
      width: "100 mm",
      rightInset: 2, leftInset: 2, topInset: 2, bottomInset: 2,
      bottomEdgeStrokeColor: "COLOR 2018",
      topEdgeStrokeColor: "COLOR 2018",
      topEdgeStrokeWeight: 1,
      bottomEdgeStrokeWeight: 1,
      rightEdgeStrokeWeight: 0,
      leftEdgeStrokeWeight: 0,
      };
      
      myTable.cells[1].paragraphs[0].remove();
      

       

       

      With that I'm change this:

      Captura de Tela 2017-08-11 às 08.46.11.png

      To this:

      Captura de Tela 2017-08-11 às 08.46.35.png

      Easy, ok?

       

      So I get stuck with some things that I call for your help:

       

      1. I'm applying the Fira Sans font in the word TITLE, but how I can use your style "Bold"? I know that's using the fontStyleName property but where?
      2. The width of my cells[1] is 100 mm, but I want this width the same size of the text frame. See the second image.
      3. I think this is the hard one! I'm using the color with name "COLOR 2018", but I will have different indesign files with different name colors. The only things that remains is the " 2018", like "BIO 2018", "MATH 2018". So is even possible to create a variable that apply the color using something like NAME + " 2018" instead the string itself?

       

      I hope you will understand what I want and I'm grateful for some help!