Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Table Frustrations

Return to Member Forum

  • Author
    Posts
    • #90692
      Nick Syrett
      Member

      I promise I have watched a few hours of tutorials before coming here! IN short, Tables Styles are driving me CRAZY!

      What am I trying to do? It is very simple. I have a simple excel table 5 rows by 7 columns. I want to bring this into ID using the place command. I have already defined a table style and a cell style. I want the ‘inside vertical strokes’ to be 2 pt white and the ‘inside horizontal strokes’ to be 2pt burgundy. The cell background for all cells is grey. There is no table border.

      This should be simple. I should be able to CMD D for place, select my excel file, hit shift+open to get the import prefs, select my table style and click onto my page. (I have my body cells correct defined in the table style (general, cell styles, body rows).

      I would expect this to work. But what actually happens is the I get a burgundy stroke along the bottom of the very last row (there should be no table border and only burgundy rows as ‘inside horizontal strokes’, NOT on the outside edge of a row). AND the burgundy stroke is not level with the righthand edge of the table… it provides to the right a little bit and look terrible.

      So I have been thinking that perhaps I am setting up the cell style strokes incorrectly — but believe it or not… I cannot see an example online or on Lynda that shows how to set one color for the vertical inside stroke and a different color stroke for the inside horizontals… I think I am doing it right.. but if so, why am I getting these problems.

      PLEASE HELP before I pull out what little hair I have left.

    • #90737
      David Blatner
      Keymaster

      I have to agree with you that table formatting — and especially how it relates to styles — can be very annoying in InDesign!

      In this case, I would suggest not using cell styles. Rather, I think you can get everything you want with just a table style. For example, this is done with just a table definition, no cell styles:

      How? Download this IDML file, open it in InDesign, and look at the table style (or the table options dialog box). Let me know if you have any questions.

      I’ll have to write this up as a blog post so others can follow along…

    • #90742
      Nick Syrett
      Member

      Thank you very much. I will give this a try this afternoon and let you know how I get on. I really appreciate the help! And I enjoy your Lynda.com course. Extremely helpful.

    • #90744
      Nick Syrett
      Member

      That worked like a dream. It was the language of ‘alternating’ in the table style that confused me. I didn’t;t want alternating strokes so assumed that I had to do it in the cell style. Now everything works great.

      I downloaded a helpful script from your website that enables me to resize my table to the size of the text frame. Is there such a script that will also allow me to apply column width size to my table columns?

      Thank again. I had many frustrating hours yesterday and one supreme moment off happiness today when this worked!

    • #90745
      Nick Syrett
      Member

      David,

      One small problem. My top row is a header row. When I thread to the next page, all works well, except that now I have a stroke along the bottom of the last row on page one. Anyway to deal with that? I don’t want any ‘table borders’ but as the table is flowing to the next page, ID seems to see this stoke as a horizontal ‘inside’ stoke and applies the formatting to it. I’m stuck again. So near, but so far!

      • #90773
        David Blatner
        Keymaster

        No, InDesign doesn’t have a way to say “put a stroke between cells, but not if it’s at the bottom or top of a column”
        I believe you would have to modify that manually, with cell styles or just selecting those rows and changing the stroke.
        Note that if you change the stroke at the bottom of one page, it will also change at the top of the next column/page (because technically that border is the same).

    • #90790

      Hi Guys,

      alternating rows are not honored by header and footer rows. So the trick is, to insert another row and convert it to a footer row, height: 0p3, border-top: 0. I modified Davids idml a bit (https://www.dropbox.com/s/ss88l05yf17qnqj/RowsAndColumns.zip?dl=0). The second table shows the final result, if you apply the table style “rows and columns”

      @ Nick: There are several scripts on the Adobe scripting forum available for dealing with column width in tables. One of the easiest will be something like that:

      app.activeDocument.stories.everyItem().tables.everyItem().columns.everyItem().width = "30mm";
      

      This line will apply a width of 30 mm to every column in every table in your document.

      Kai

      • #90811
        Nick Syrett
        Member

        @kai Thank you again for the suggestion for the script re column widths. I have something even more specific. I have a table that has 7 columns and each columns has to be a different width. Can you point me in the direction of a script that will help me define each of the 7 column widths with one easy click of the script! I am not too sure where to look. Many thanks.

      • #90812

        Nick, select your whole table and try this one:

        app.doScript(main, ScriptLanguage.JAVASCRIPT , [], UndoModes.ENTIRE_SCRIPT, "column width");
        
        function main() {
        
        var colValues = [10, 20, 30, 40, 50, 60, 70]; // insert here your values !
        
        if (!app.selection.length || app.selection[0].constructor.name != "Table") {
          alert("wrong selection");
          return;
        }
        
        var allColumns = app.selection[0].columns;
        var nCols = allColumns.length;
        
        if (colValues.length != nCols) {
          alert("check your 'colValues' list");
          return;
        }
        
        for (var i = 0; i < nCols; i++) {
          var curCol = allColumns[i];
          curCol.width = colValues[i];
        }
        }
        
      • #90814
        Nick Syrett
        Member

        @kai thank you. Now I need to figure out how to implement your script (I’m pretty new to InDesign). I did manage to download and adjust the previous script mentioned in this trail, but with that, I had a file to work with. I’m not sure how to implement your script without a file etc. Any pointers? Thanks

      • #90815
        Nick Syrett
        Member

        I figured it out! Simply duplicated an already existing script, renamed and replaced the code with your code. Seems to work! Thanks. I am learning a lot today!

    • #90804
      David Blatner
      Keymaster

      I wrote up the Table Strokes article here:
      https://creativepro.com/how-to-set-column-and-row-strokes-in-table-styles.php

      Kai, is that the correct URL for the new IDML file? I downloaded your zip file, but it appears to be the same file I created (I see only one table).

    • #90806

      David, I zipped the wrong one. Try this URL: https://www.dropbox.com/s/cnscyjjw8n22lsz/lastRowInTable.zip?dl=0

      If someone find this method useful, but is afraid of extending textframes: This whole thing is scriptable! :)

      Kai

    • #90807
      David Blatner
      Keymaster

      Kai: Got it! Interesting technique… the header and footer rows “erase” the stroke at the top and bottom of each column/page. Clever!

    • #90808

      Yes! And if there is no need for header rows, a footer row is enough to erase the stroke!

    • #90809
      Nick Syrett
      Member

      David and Kai

      Thank you so much for all this help. I feel a little dumb not figuring out the ‘alternating rows/columns’ issue, but on the other hand, I don’t think Adobe makes that super obvious! Thank you again David.

      And Kai, thank you for the footer row trick to remove the unwanted strokes on my table that spans text frames. Excellent. Now I have what I wanted!

      I’ll try out the ‘column width’ scripting. Wow… scripts!!! You guys are making me begin to feel like an expert!

    • #90817
      David Blatner
      Keymaster

      Nick, here is an article about how to install scripts that Kai and others have left in forum or blog posts:
      https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php

Viewing 11 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads