6 Replies Latest reply on Apr 21, 2009 1:26 AM by dave mil

    [CS2][JS] Cell and strokeType

    dave mil

      Hello,

       

      I want to define the strokeType of a cell, but i don't find solution, I tried :

       

      myTable1.cells[0].topEdgeStrokeType = "Solid";

      myTable1.cells[0].topEdgeStrokeType = idSolid;

        • 1. Re: [CS2][JS] Cell and strokeType
          Harbs. Level 6

          You need:

          myStrokeType = app.strokeStyles.item("Solid");
          myTable1.cells[0].topEdgeStrokeType = myStrokeType;
          

           

          Harbs

          http://www.in-tools.com

          • 2. Re: [CS2][JS] Cell and strokeType
            dave mil Level 1

            I tried your solution but it doesn't work. I have an error : topEdgeStrokeType wait StrokeStyle not nothing

            • 3. Re: [CS2][JS] Cell and strokeType
              Kasyan Servetsky Level 5

              I an on CS3, but this works for me:

               

              var myDoc = app.activeDocument;
              var myTable1 = myDoc.stories[0].tables[0];
              myTable1.cells[0].topEdgeStrokeType = "Solid";

              • 4. Re: [CS2][JS] Cell and strokeType
                dave mil Level 1

                On CS2 version, it doesn't work

                 

                My script :

                 

                var myTextFrTab1 = page.textFrames.add(undefined, undefined, undefined, {geometricBounds:["20mm","15.061mm","278mm","100mm"]});
                var myTable1 = myTextFrTab1.tables.add();
                myTable1.bodyRowCount = 7;

                myTable1.columnCount = 2;
                myTable1.width = "42mm";
                myTable1.height = "277mm";
                                               
                // Fusion des cellules pour obtenir le tableau adéquate
                myTable1.cells.item(0).merge( myTable1.cells.item(1) );
                myTable1.cells.item(2).merge( myTable1.cells.item(4) );
                myTable1.cells.item(2).merge( myTable1.cells.item(5) );
                myTable1.cells.item(2).merge( myTable1.cells.item(6) );
                myTable1.cells.item(2).merge( myTable1.cells.item(7) );
                myTable1.cells.item(6).merge( myTable1.cells.item(7) );                                       
                                                                       
                //Titre       
                myTable1.cells.item(0).height = "12mm";
                myTable1.cells.item(0).maximumHeight = "12mm";
                myTable1.cells.item(0).width = "84.763mm";
                myTable1.cells[0].topInset = 1;
                myTable1.cells[0].bottomInset = 1;
                myTable1.cells[0].leftInset = 1;
                myTable1.cells[0].rightInset = 1;
                myTable1.cells[0].verticalJustification = VerticalJustification.centerAlign;                                                  
                             

                //Référence             

                myTable1.cells.item(1).height = "4mm";               

                myTable1.cells.item(1).maximumHeight = "4mm";                               

                myTable1.cells.item(1).width = "25.694mm";                               
                               

                //Objectif                                              

                myTable1.cells.item(2).width = "59.217mm";             

                myTable1.cells.item(2).autoGrow = true;               
                              

                //Duree              

                myTable1.cells.item(3).height = "4mm";               

                myTable1.cells.item(3).maximumHeight = "4mm";               

                myTable1.cells.item(3).width = "25.694mm";
                               

                //Prix              

                myTable1.cells.item(4).height = "4mm";              

                myTable1.cells.item(4).maximumHeight = "4mm";                              

                myTable1.cells.item(4).width = "25.694mm";
                               

                //dates               

                myTable1.cells.item(5).height = "4mm";               

                myTable1.cells.item(5).maximumHeight = "4mm";                               

                myTable1.cells.item(5).width = "25.694mm";
                               

                //Info              

                myTable1.cells.item(6).width = "25.694mm";
                               

                //Programme                           

                myTable1.cells.item(7).width = "59.217mm";               

                myTable1.cells.item(7).autoGrow = true;


                //var aa = app.strokeStyles.item(13).id;//pointillés              

                //myTable1.cells[0].topEdgeStrokeType = app.strokeStyles.item(13);             

                myTable1.topEdgeStrokeType = app.strokeStyles.item(13);                              

                //myTable1.cells[0].topEdgeStrokeType = "Solid";

                //myTable1.cells[0].topEdgeStrokeType = app.strokeStyles.item(13);

                //myTable1.cells[0].topEdgeStrokeType = app.strokeStyles.item("dotted");

                • 5. Re: [CS2][JS] Cell and strokeType
                  Harbs. Level 6

                  CS2 needs a strokeStyle. Strings don't work there.

                   

                  I just tested the following code in CS2 and it works fine. If it 

                  doesn't work for you, then you either do not have a stroke named 

                  "Solid", or you do not have a proper reference to a table...

                   

                  table=app.selection[0].tables[0];
                  strokeStyle= app.documents[0].strokeStyles.item("Solid");
                  table.cells[0].topEdgeStrokeType = strokeStyle;
                  

                  Harbs

                  http://www.in-tools.com

                  "Automated Publishing for the Rest of Us!"

                  • 6. Re: [CS2][JS] Cell and strokeType
                    dave mil Level 1

                    Ok, i have found. I must use "Pointillés" and not "Dotted".