Jump to content

Buford T. Justice

Members
  • Content Count

    4
  • Joined

  • Last visited

  • Days Won

    1

Buford T. Justice last won the day on July 26

Buford T. Justice had the most liked content!

Community Reputation

1 Neutral

1 Follower

About Buford T. Justice

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Folks, Finally an experienced InDesign scripter helped me to find a solution that works perfectly 👍 This is the correct JS syntax for text alignment in the specific table cell: curTable.columns[-2].cells.everyItem().texts.everyItem().justification = Justification.RIGHT_JUSTIFIED; The missing key was the relation to the cell itself. After adding the code the (horizontal) 'justification' property is working now. He also recommended an InDesign specific resource website providing a complete overview to other suitable commands / properties - here at the 'text' section: https://www.indesignjs.de/extendscriptAPI/indesign14/#Text.html#d1e452798 Example for another property 'setting an indent' in the respective table cell: curTable.columns[-2].cells.everyItem().texts.everyItem().rightIndent = 2.25; From my side the topic can be closed now. Thanks to everyone for assisting on the issue. Regards
  2. Hello dsonesuk, Thank's for your reply. I attached a screenshot of a sample table from my document. It has five columns - the first (counted from left) contains placeholders for images, the four others text and numbers. The screenshot shows that the script is applied to the second last column when running the 'select' command for example. The assignment to the correct column already works: curTable.columns[-2].select(); //select the cells in the column I hope I didn't get you wrong but I don't understand why you think there is an index problem. I'm able to execute the commands I listed before to operate on a table, they all work fine on the second last column. My question: I'm selecting the second last column in only one existing table by my script - what would be the correct JS syntax for aligning this selected column and it's text or numbers content to the right? I just miss this last step and wonder if there is a way to do it by a command inserted after: curTable.columns[-2]. As I mentioned in my last post I wonder if there's a way at all to get the alignment working on the table column itself, because I couldn't find a command for horizontal alignment in tables on any website with JS code sets and instructions that work on InDesign tables, e.g. on pages like http://jongware.mit.edu/idcs6js/pc_Table.html. This is what I wrote in my last post and I still wonder about it: Thanks BTJ
  3. curTable.columns[-2].verticalJustification = VerticalJustification.CENTER_ALIGN; //center cell vertically curTable.columns[-2].width = 100; //set width to 100 mm curTable.columns[-2].leftInset = 10; //add 10 mm space to left margin curTable.columns[-2].remove(); //delete the whole second last column curTable.columns[-2].select(); //select the cells in the column Hi shaili_shah, thank you for your suggestion. I tried to implement the css code in mine but it doesn't work. I tried a lot but couldn't find a way to combine the syntax. I guess in order to get this css working the whole script has to be re-written or get a new structure at least. Unfortunately I don't have the know-how and time to do that. I added some code examples I got to work before and explained what they do. They all relate to the second last column of the tables. I'm looking for a simple addition I can add after curTable.columns[-2]. to align text in the cells to the right (if this is possible). It's easy to align vertically, but what's the correct JS syntax to do it horizontally? What I guess is that vertical alignment affects the table 'construction' with it's rows and columns but not the text in the cells, and that's the reason I can't find a generic code for text alignment when adressing the column only. Just my reflection. I appreciate your help but I need someone to finish the code or re-arrange it to get it to work. Thanks Regards
  4. var curDoc = app.documents[0]; var allTables = curDoc.stories.everyItem().tables.everyItem().getElements(); for ( var i = 0; i < allTables.length; i++ ) { var curTable = allTables[i]; if ( curTable.columns.length == 5) { curTable.columns[-2].verticalJustification = VerticalJustification.CENTER_ALIGN; //HERE SHOULD BE THE CODE FOR ALIGNING TEXT IN SECOND LAST COLUMN TO RIGHT } } Hello W3Schools community, I need your help on a final step in my Javascript code for an Adobe InDesign document. In the InDesign document there are many tables that have all five columns. My script (.jsx file, executed in InDesign) works fine by vertically aligning all second last columns in every table in the whole document to center. I just tested if it works, the vertical alignment is not needed. I'm glad about this success, because I'm a newbie to JS in InDesign and did a lot of 'try and error' in order to locate and aligning the cells. What I'm really looking for is to align the text horizontally in all second last columns from left to right alignment. A simple operation certainly, but I'm totally stuck with the correct JS syntax... I tried all functions I could find at W3Schools and on the web, e.g. 'text-align: right' or 'Justification.RIGHT_ALIGN' referring to the working 'verticalJustification' function but nothing works to align the text in the cells. There are many examples for easy alignment in HTML and it's 'divs', respectively CSS, but nothing seems to work in JS code. Thank you in advance – i would highly appreciate your help because this script saves a lot of time in my projects! Regards
×
×
  • Create New...