Tables in InDesign using JavaScript

I am fairly new to scripting and hoped someone could help me a table script InDesign. I already have the updated styles in place. What I need is some advice to apply styles to specific lines - so, application of styles to header and footer and application of style for the remaining lines. Any help would be much appreciated as I'm pulling what little hair I...

See you soon

Dave

Dave,

The key is that Table.rows has its own property .cells, a collection of only the cells in the same row. So, to adapt your code:

using your version; I prefer return 0 if table not found

function findTable (obj) {}

While (obj.constructor.name! = 'Table') {}

obj = obj.parent;

If (obj.constructor.name == "Application") {}

launch "could not find the table."

}

}

return of items

}

var myTable = 0;

If (app.documents.length > 0 & app.selection.length > 0)

myTable = findTable(app.selection[0]);

check at least enough lines for 1 row from the top, 1 body line, row 1 down

If (myTable! = 0 & myTable.rows.length > = 3) {}

remove all the rules; the INSET value 0

myTable.cells.everyItem () .appliedCellStyle = "[None]";

row of below format

(don't forget the account of the lines uses 0-based)

a = myTable.rows.length - 1;

myTable.rows [a].cells.everyItem () .appliedCellStyle = "4.cell_body_last";

format rows

first = 1;

last = myTable.rows.length - 2;

for (a = first;<= last;="">

myTable.rows [a].cells.everyItem () .appliedCellStyle = "3.cell_body";

row of the top format

a = 0;

myTable.rows [a].cells.everyItem () .appliedCellStyle = "2.cell_header";

}

Hope this helps,
Steve Caine

Tags: InDesign

Similar Questions

  • How to select a line of table on click using javascript?

    I have an ADF table with some data. If the user clicks on a cell in the table, I want to do something for the whole line.

    However, the event.getSource () method only gives me the column that was clicked.

    How can I find the line using Javascript?

    Hello

    Try the approach given by frank at https://forums.oracle.com/thread/2205398

  • How to create indesign using Java Script

    I am new to indesign and want to create indesign application using JavaScript.

    When I use AppleScript to create the Application Indesign I use this statement

    Tell application "Adobe InDesign CS5.5"

    myDocument to make document with the properties of the value

    tell the end

    Application InDesign create successfully.

    How to create the Application Indesign using JavaScript?

    or what is set equivalent to (tell application "Adobe InDesign CS5.5") in Java Script.

    There is a sample java script given on the forum or in the sdk. These departure example with app.

    When I debug these java script using ExtendScript ToolKit 3.6 it gives error on app (application not defined). I think that this app AI application object.

    How to create indesign application object app in javascript?

    Although this script runs successfully when I put these script in C:\Program Files\Adobe\Adobe InDesign CS5.5\Scripts

    and executing these script use the Scripts panel (choose window > utilities > Scripts), and then double-click the script name in the Scripts panel in indesign application. But in this case I have indesign application start and then choose window > utilities > Scripts, and then double-click the script name in the Scripts panel.

    I want to create Application Indesign (instance), using JavaScript.When I run or (debug) my JavaScript in any javaScript tool as ExtendScript ToolKit 3.6 then Indesign application should start, as in the Apple Script.

    Thank you

    long story short... NO!

    However, if you run the script from ESTK, you need not copy the script in the folder "Scripts". Do not know exactly if that's what you want.

  • [JS CS3, win] Saving InDesign using app.activeDocument.save

    Hello.

    I have problems saving a document in InDesign using Javascript.

    My goal is to have a box in the document where I type the name of the file and the path where I want to save the InDesign file (eventually it will be generated from a datamerge).

    Then, I want to run a script that will read the contents of the box and then save the document to the file name or location.

    At the moment I have:

    SaveText.jsx
    A JavaScript InDesign CS3
    //
    Saves the document in the provided path

    get the content of the FileNameBox box on the document
    var varFileName = app.activeDocument.textFrames.item("FileNameBox").contents;
    Save now
    app.activeDocument.save ("/" + varFileName + ".indd");

    Alert (app.activeDocument.filePath);

    When I run the script (with 'Hello' in the FileNameBox) file changes its name on the top bar of InDesign to "Hello.indd", but (when I run the commented warning at the end) the file is not actually save anywhere.

    If I close InDesign, then open it the file is listed under 'Open recent' on the menu, but clicking on it does nothing - even when the file does not exist.

    Does anyone have ideas to help me to tear my hair out?

    Where is my save file? (Or, if not, how can I do save!).

    Thanks in advance for any help you can offer.

    var myFolder = new Folder ("~/Desktop/Test");
    If (! myFolder.exist) myFolder.create ();
    var varFileName = app.activeDocument.textFrames.item("FileNameBox").contents;
    app.activeDocument.save (myFolder.fsName + "\" + varFileName + ".indd");
    Alert (App.activeDocument.FilePath);

  • How to export the Indesign to Format XML using JavaScript document

    Hi all...

    Can someone help me, how to export the indesign document to XML Format using JavaScript...

    Thanks in advance...

    doc.exportFile ( ExportFormat.XML, File(Folder.desktop+"/doc.xml" )
    
  • How to change type of police using InDesign scripting (Javascript)?

    Hello

    I need to change the font type of a document, InDesign using InDesign script (javascript). I found a few online references in the InDesign scripting guide and running extract next, gives me errors.

    Delete existing preferences

    app.changeTextPreferences = NothingEnum.nothing;

    app.findTextPreferences = NothingEnum.nothing;

    app.findChangeTextOptions.caseSensitive = false;

    app.changeTextPreferences.appliedFont = app.fonts.item ("DEVANAGARI MT");

    App.Documents.Item (0) .changeText ();

    Download the msg of InDesign server.

    Error code: 1

    Error description: changeText

    The indesign file that is used to change the font is certainly not corrupt, cause the following script to export the file in .png works very well. Any help appreciated.

    app.pngExportPreferences.exportResolution = 100.0;

    App.Documents.Item (0) .exportFile (ExportFormat.PNG_FORMAT, PreviewDocument don't);

    Hello

    Try this 1-liner:

    app.documents.item(0).stories.everyItem().appliedFont = app.fonts.item("DEVANAGARI MT");
    

    Guess above specified police is available. Some disorders may begin with the name of the font, cause not always WYSIWYG.

    To be sure how to refer to a specific font by its name - a console text and notice of runing ESTK select this option:

    app.selection[0].appliedFont.name
    

    Jarek

  • Setting value using javascript on the form of tables created by APEX_ITEM

    I can assign the value using javascript on normal form of table as below:

    var vRow = pThis.id.substr (pThis.id.indexOf ('_') + 1);
    $x_Value ('f05_' + vRow, 'Value');

    However I can't do the same if the tabular presentation is dynamically created by APEX_ITEM.

    Some tips on how to do this?

    Thank you

    If this should not be something like:

    this.id.substring(4, 8)
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • How to use Javascript to loop through a tabular presentation

    APEX: 4.2.3

    DB: 11 GR 2

    Requirement:

    I have a master form / retail. We will see that master is the order information; Detail is the order lines. Detailed form is tabular

    The detailed form, there is an attribute called 'Line Order Qty' and the user can update this field.

    User can update all rows in the detail forms and change "line Order Qty' for each line. When the user click on 'Save' button on Master form, I have to do below:

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    By reading this thread: building the perfect beast: Oracle APEX - Soft Validation using dynamic measurements

    I think I need to create a reference for action (DA) dymaic Javascript expression; However, in Javascript, how do I browse a table?

    Yet once, I need an example of using Javascript to browse tabular forms in the form master / detail.

    I don't know that my question should be raised before; but I can't find a good match of thread.

    Thank you!

    Kevin

    Hi Kevin Zhang,

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    Follow the steps below

    Step 1: Change your page - > function and declaration of the Global Variable-> to insert the code below

    (i) f06 is here, the column on which I am looping the f06 column and enters the total variable to the value change in the values of the row that is changed by the user.

    (II) also replace your column with f06 markup on which you want to loop and calculate the total

    (III) assuming that P6_ITEM is the point where you plan_order_qty, replace with your article.

    (IV) SAVE this demand is what happens when OK is clicked, assign the request to process.which you give the floor to a click of the button SAVE the

    function update_order_qty () {
      var line_order_qty_tot = 0;
      $("input[name='f06']").each(function() {
        line_order_qty_tot += parseFloat($(this).val().replace(/,/g,''))||0;
      });
    
      var plan_order_qty = apex.item( "P6_ITEM" ).getValue()
    
      if (line_order_qty_tot > plan_order_qty) {
          apex.confirm('Are you sure?', 'SAVE');
      } else {
          apex.submit( 'SAVE' );
      }
    }
    

    Step 2: Edit the page-> Execute when loading the page-> to insert the code below

    \\calculate the total on change
       $("input[name='f06']").change(function(){update_order_qt();})
    

    Step 3: Change your button Save and put under the Action when the button is clicked

    Action: Redirect URL

    Target URL:

    javascript:update_order_qty();
    

    Hope this helps you,

    Kind regards

    Jitendra

  • How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC

    The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.

  • Pop - up using javascript in dynamics of the Actions

    Hi all

    Before you begin with the question, I want to share the below of the details on the application

    Table creation script

    create table status_dashboard (ID number, name varchar2 (10), varchar2 (10) State, varchar2 (1000)) URL;

    Insert the script

    insert into status_dashboard values 1, 'A1', 'up', 'www.ibm.com';

    insert into status_dashboard values 1, 'B1', 'up', 'www.hp.com';

    "insert into status_dashboard values 1, 'C1', 'up', ' www.msn.com";

    insert into status_dashboard values (1, "D1", "low", "www.yahoo.com'");

    insert into status_dashboard values 1, 'E1', 'up', 'www.oracle.com';

    insert into status_dashboard values 1, 'F1', 'up', 'www.facebook.com';

    insert into status_dashboard values (1, 'G1', 'down', 'www.twitter.com');

    "insert into status_dashboard values 1, 'H1', 'up', ' www.google.com ';

    insert into status_dashboard values 1, 'I1', 'up', 'www.apex.oracle.com';

    Report query

    SELECT max (case when mod (rn, 3) = 1 then end name) col1

    , max (case when mod (rn, 3) = 2 then end name) col2

    , max (case when mod (rn, 3) = 0 then end name) col3

    , max (case when mod (rn, 3) = 1 then decode (status, 'down', 'red', 'green') end) The_color1

    , max (case when mod (rn, 3) = 2 decode (status, 'down', 'red', 'green') then end) The_color2

    , max (case when mod (rn, 3) = 0 then decode (status, 'down', 'red', 'green') end) The_color3

    , ceil ((rn) / 3)

    (select name, status, row_number() on rn (order by name) of status_dashboard)

    Group by ceil ((rn) / 3)

    order by ceil ((rn) / 3)

    Report link on Oracle Apex

    https://Apex.Oracle.com/pls/Apex/f?p=54850:1

    I created a matrix report, enabled the conditional formatting. The only problem I have right now is to go to a link in the report.

    I use 3 text elements Apex - P1_ID, P1_NAME and P1_URL.

    I use also 3 dynamic actions

    1. DEFINE NAME - will set the P1_NAME field with the value clicked in the report.

    2 SET ID & URL - define the fields P1_ID and P1_URL of the DB using the P1_NAME field.

    3-pop-up-appears the P1_URL using javascript.

    Problem statement:

    The pop up page is a blank page, although I can see that the value for the P1_URL field is defined using dynamic measurements.

    Could someone please take a look at this example and help me with the same.

    PS: The example was developed using sample data.

    Hello

    When you use the substitution in JavaScript string, the value is used when page and is pretty hard-coded in the document value.

    Even if you change the value of the element or the element value in session state, it will not happen to the HTML document.

    In dynamic action, try something like

    popupURL($v("P1_URL"))
    

    Who will choose the value of the item and pass it to the popupURL function.

    Yes, you have created, sample, but how we can view source if we are unable to connect your workspace?

    Kind regards

    Jari

  • Can you create Destinations named by using JavaScript?

    I am creating a menu option in Adobe Acrobat that uses JavaScript to parse through a large pdf document and create named destinations by using the titles in the document.

    The titles all follow the same format unique, so I am able to identify them using regex. Once I found a title, I identify also the page it's on--and I store several times the title and the page in a table.

    My plan was to create named destinations using the information stored in the array. However, I did have a lot of chance to find how to create destinations named with JavaScript.

    Any input would be appreciated.

    Not possible with Acrobat Javascript.

  • How to incorporate paths in InDesign using ExtendScript document?

    Hello

    I have graphics vector somes in an Illustrator document that I need to integrate into an InDesign document. To do this, I use javascript, Scripting InDesign CS6 of targeting.

    What I managed to do is the AI placement in a rectangle in InDesign:

    var rectangle = page.rectangles.add();
    rectangle.geometricBounds = [15, 15, 15 + 30, 15 + 40];
    var aiFile = File("/d/test.ai");
    rectangle.place(aiFile);
    

    It works fine I get my file I put the rectangle. However, it creates a link to the file have, while I would like to integrate each path draw lots in InDesign.

    Is it possible to copy vector using scripts, as graphics when you select, copy paste from Illustrator into InDesign?

    Hey Kevin,

    You can disassociate the link of the placed Illustrator file.

    In your case it would work like this:

    var rectangle = page.rectangles.add();
    rectangle.geometricBounds = [15, 15, 15 + 30, 15 + 40];
    var aiFile = File("/d/test.ai");
    rectangle.place(aiFile);
    
    //Embed the placed AI file:
    rectangle.graphics[0].itemLink.unlink();
    

    However, this isn't the same vector copying / pasting shapes from Illustrator into InDesign.

    The file placed remains a file embedded PDF type on the page.

    If you want to copy and paste paths, you must Access Illustrator and InDesign scripting, do not place the files in InDesign.

    But there is a good chance that you will end up with very strange constructions on the page in InDesign. Or you might fail for reasons of the strange. 'Easy' routes might work, "complex" will not and throw errors.

    To access Illustrator, you can use the BridgeTalk of ExtendScript features. Or maybe AppleScript, if you are on a Mac.
    Refer to the Documentation from Adobe for BridgeTalk script or search this forum or on the web. There is nothing for beginners, I would say.

    Uwe

  • Extract PDF form data using JavaScript and write in the CSV file

    I received a PDF file with a form.  The form is * not * formatted as a table.  My requirement is to extract form field values and write into a CSV file that can be imported into Excel.  I tried using the menu item "Merge data from spreadsheet files" automated in Acrobat Pro, but the release includes both the labels and values.  I'm mostly just interested in the form field values.

    I would use JavaScript to extract the data from the form and learn JavaScript write CSV file (since I know what should look like the spreadsheet of end).  I got regarding the extraction of the fields in the form:

    this.getField("Today_s_Date").value;

    And the rest of this post: http://StackOverflow.com/questions/17422514/how-to-write-a-text-file-in-Acrobat-JavaScript , I tried to write to CSV using:

    var cMyC = "abc";

    var doc = this.createDataObject ({cName: "test.txt", cValue: cMyC});

    but I get the following error:

    "SyntaxError: syntax error".

    1:Console:Exec ".

    Ideally, I don't want to use a third-party tool online to make, because the data are sensitive.  But please let me know if you have any suggestions.  The ideal output is a CSV file that an end business user can open in Excel to see the format of spreadsheet of his choice.

    Did anyone done this before?  Open to hearing alternatives as well.  Thanks in advance!

    The code you have posted works fine for me in the JavaScript console, so I suspect the problem is something else. Where did he put the code and y at - he seized another code?

    In addition, if CSV is not a strong requirement, I would say that you use delimited by tabs instead. Fields normally cannot contain tab characters, this is a good qualifier to use. It will be also more reliable when you import in Excel. If you need to process the field data that may contain quotes, you need prepare correctly the string data and can use a JavaScript library like this: https://github.com/uselesscode/ucsv

  • I want to af:table values get in javascript array

    I have ADFRichTable and enter the values of af: table table Javascript.

    I use the javascript code:

    document.getElementById("t1:49:ot3").innerHTML works

    Because document.getElementById("t1:50:ot3").innerHTML does not work

    AF:table recover in 50 lines.

    How to get af:table all values in Javascript?

    User, before going into the details, we need to understand what you're trying to do.

    Please describe your use case (and don't tell us that you need the data in javascript, we nee know why).

    And tell us your jdev version.

    Timo

    Post edited by: TimoHahn

    I just saw this post is a duplicate of https://forums.oracle.com/message/11166039#11166039
    Please do not post questions several times!

  • Convert pages of propagation for unique pages using javascript

    Hi all

    Is there a way to convert all pages in the spread or pages face to face unique pages in an Indesign document using javascript. I use Indesign CS6. Used master pages are unique pages only. Thanks in advance.

    Before:

    Spreadpages.PNG

    After:

    Singlepages.PNG

    Kind regards

    Bachi. D

    Hello

    app.activeDocument.documentPreferences.facingPages = false;

    app.activeDocument.spreads.everyItem () .allowPageShuffle = true;

    Rgds

    Jarek

Maybe you are looking for

  • start of the tabs will not define

    I'm new to Firefox (Google Chrome kept showing adware), I managed to import all of my settings, but I can't just not Firefox to start with a set of predefined tabs. I opened the option and created a folder of bookmarks and choose this folder in the "

  • Re: How to unlock a L755 Satellite?

    Since yesterday, I get by typing my password of this text: the user profile Service service do not allow you to use this account. The problem is that the account is my administrator account, I can only use my laptop on my guest account. Thank you for

  • Pirates

    I WAS CONTACTED BY PHONE BY SOMEONE MICROSOFT POST-COLONIAL AND TELLING ME MY LAPTOP IS NOT WORKING PROPERLY AND HI CAN FIXIT IF I PAY HIM £200.  IS IT A SCAM?

  • LaserJet p1102w: hp laserjet p1102w have downloaded drivers from the web site but does not work

    Tried to download the driver from hp Web site wireless or usb connect to laserjet 1102w but stoops working and quots will prompt you to dissconect cable when the wireless connection is established... but never happens! Help please

  • registered Web site

    When I click on a computer Web site registered just started to go on site, updates starts loading, then automatically updates google, says "your search does not match any documents. Why is it doing this? I've been on this site for hours? It's a chat