Skip to main content
Liphou
Inspiring
July 3, 2018
Question

[JS] Changer la couleur d'un texte dans une cell

  • July 3, 2018
  • 1 reply
  • 1385 views

Bonjour,

Je cherche à modifier un de mes scripts pour mettre en couleur le texte d'une cellule (points d'insertion)  ou de plusieurs cellules sélectionner.

voici le script de départ actuellement il change la couleur de fond de la ou les cellules :

//$.writeln(app.selection[0].parent.constructor.name);

//$.writeln(app.selection[0].parent.fillTint);

       

    // app.selection[0].parent.fillTint = 25;

     if (app.selection[0].constructor.name === "InsertionPoint") {

       

            app.selection[0].parent.fillTint = 25;

        } else {

    

            app.selection[0].cells.everyItem().fillTint = 25;

     }

je dois utiliser la commende fillColor mais je bloc au niveau des parents.

Merci pour votre aide

Philou

This topic has been closed for replies.

1 reply

Liphou
LiphouAuthor
Inspiring
July 3, 2018

Ok pour une seul cellule

app.selection[0].parent.texts[0].fillColor = maCouleurs;

Liphou
LiphouAuthor
Inspiring
July 3, 2018

Voilà

cela devrait suffire :

//$.writeln(app.selection[0].parent.constructor.name);

//$.writeln(app.selection[0].parent.fillTint);

  

    if (app.selection[0].constructor.name === "InsertionPoint") {

       

          app.selection[0].parent.texts[0].fillColor = app.activeDocument.colors.item("Bleu Claire");

         

        } else {

    

       

              for (var i = 0; i < app.selection[0].cells.length; i++) {

                  app.selection[0].cells.texts[0].fillColor = app.activeDocument.colors.item("Bleu Claire");

                  }

             

     }

Si vous avez quelque chose de plus rapide ?

Merci à vous

Philou

Community Expert
July 3, 2018

Hi Philou,

just a note for all using the translation feature of the forum:

The code will change a bit if you let the forum translate this to English.

Some examples:

if becomes If

colors.item ("clear blue") becomes colors.item (,"clear blue",)

So be careful if you copy code!

Regards,

Uwe