Table styles to all of document?

I have a script (kindly taken from this forum, see below) that applies table/cell styles to a tables you have selected, is there a way to apply this to all tables in the document in one go?
its a basic style, just a header row body content and footer row.
Many thanks.
// using your version; I'd prefer to return 0 if table not found
function findTable(obj) {
         while (obj.constructor.name != "Table") {
        obj = obj.parent;
        if (obj.constructor.name == "Application") {
            throw "Can't find table"
    return obj
var myTable = 0;
if (app.documents.length > 0 && app.selection.length > 0)
    myTable = findTable(app.selection[0]);
// check for at least enough rows for 1 top row, 1 body row, 1 bottom row
if (myTable != 0 && myTable.rows.length >= 3) {
    // delete all rules; set insets to 0
    myTable.cells.everyItem().appliedCellStyle = "[None]";
    // format bottom row
    // (remember rows uses 0-based count)
    a = myTable.rows.length - 1;
    myTable.rows[a].cells.everyItem().appliedCellStyle = "4.cell_body_last";
    // format middle rows
    first = 1;
     last = myTable.rows.length - 2;
    for (a = first; a <= last; ++a)
        myTable.rows[a].cells.everyItem().appliedCellStyle = "3.cell_body";
    // format top row
    a = 0;
    myTable.rows[a].cells.everyItem().appliedCellStyle = "2.cell_header";

(Stepping in for Ram)
It's a bit easier than you think. Ram's code physically selects each table, and that's not even necessary. I'd change his
var myTab = MyDoc.textFrames[i].tables[j];
                myTab.select();
                YourFunction(); // Call your function here
(which works on a selection) to
myTab = MyDoc.textFrames[i].tables[j];
ProcessOneTable (myTab);
(still using a variable, although that's not really necessary). Then change your code into a function, like this. Remove the lines
var myTable = 0;
if (app.documents.length > 0 && app.selection.length > 0)
    myTable = findTable(app.selection[0]);
and replace with
function ProcessOneTable(myTable)
-- and add a closing brace after the very last line. As you can see, the function gets called with a variable "myTable" set to each one of the tables in your current document. The rest should stay unchanged.

Similar Messages

  • Create a new table style based on an existing table in a document

    Hi,
    In a document I'm working on, there is a specific table. It is made in the past by a colleague, and it has a very suitable format.
    Therefore I would like to use the layout of this table on all future tables in my document (or even in others).
    Is there an option to select my table, and create a new table style with it, so that I can use it over and over again? That would be very helpful.
    I'm working in MS Word, MS Office Professional Plus 2010, on a Windows 7 64-bit OS.
    Best regards, Sietske
    Ps.: I know
    a question like this was already asked, but the answer was quite dissatisfying (because it was not answering the question)
    Pps: Note that I'm now creating a new table style from scratch, so an answer to the above question is not that urgent, but it would still be nice to know for future use.

    you can  use format painter
    i hope that you already know about it.
    Nope, not the right answer. With Format Painter, you can copy the format of the table, but you can't create a new Table Style with it. I am looking for a solution as well.

  • When opening a word document, I get this:The table of contents is empty because none of the paragraph styles selected in the Document Inspector are used in the document. Is there a way to solve this?

    The table of contents is empty because none of the paragraph styles selected in the Document Inspector are used in the document.
    The above is what I get when I open a word document. Is there a way to solve this?

    Hmmm. Apply the styles?
    Peter

  • How do you have the bottom stroke of a table show up using Table Styles and Cell Styles only?

    I am using InDesign CS6, and I want to create a Table Style that has the bottom stroke show up, but does not have a table border, such as:
    However, whenever I try to change the Table or Cell strokes so that the last stroke shows up, I get the entire table border, or some strange combination of borders:
    Does anyone have any insight on how I can get the bottom stroke to show up while preserving my other stroke properties? Since I work with long documents, it's necessary to be able to control all of my tables through Table Styles and Cell Styles, and not by manually changing each and every table with the Stroke palette.
    For reference, here are the my current Table Style properties and the resulting table:

    Michael Murphy is the InDesign style-meister. He wrote "Adobe InDesign Styles" for Adobe Press, and did a great Lynda.com title on InDesign styling. Here's what he says in the book:
    "As mentioned at the beginning of this chapter, with all the power of table and cell styles, it is important to understand not only how they work and what they can do for you, but also to understand their limitations.
    "Two formatting features missing in table and cell styles have already been discussed: You will always have to set the column width and row height of cells when applying a table style for the first time, and you will always have to convert body rows to header and/or footer rows every time you apply a table style for first time or update the table's data....
    "But there's another kind of limitation that's important to keep in mind as you are designing tables: It is very easy to design a table that cannot be completely defined by a table style. In many cases, you'll need to define an extra cell style or two that lets you complete for formatting. [my emphasis]."
    So I think that's what you have to do: Apply another cell style on top of the cells at the bottom of the table after applying the table style.

  • InDesign CS3 crashing adding table style...HELP!!

    This issue started on Friday.  I just starting working on a large document that will have many tables throughout, so I must use the table styles.  Here is the order in which I do things to get the crash.
    Place document from Word in to InDesign document
    Highlight table to be changed
    Convert text using paragraph styles
    Alter column widths to fit page
    Highlight entire table to select table style
    Click desired table style
    CRASH!!!!
    I have tried the following things with NO LUCK:
    Deleted adobefntX file multiple times (actually worked for a couple of hours first time I did it)
    Deleted InDesign preferences (did nothing)
    Re-created all "Styles" in InDesign (Character, Paragraph, Cell, & Table) (Did nothing)
    Changed the order in which I altered the tables text and formatting (thinking it was just a silly order problem)
    Unistalled and Re-installed CS3 (worked for 5 tables and then CRASH)
    Updated ALL software (Adobe and Mac)
    Started up in Safe mode and CRASH!!!
    I realize from seraching for this problem on the web that I am probably the ONLY person having this issue, but I thought it was a font problem until I started in Safe Mode and still crashed.  I am totally confused as to what I should do next.  I am running on a
    Model Name:    MacBook Pro
    Model Identifier:    MacBookPro4,1
    Processor Name:    Intel Core 2 Duo
    Processor Speed:    2.4 GHz
    Number Of Processors:    1
    Total Number Of Cores:    2
    L2 Cache:    3 MB
    Memory:    4 GB
    Bus Speed:    800 MHz
    Boot ROM Version:    MBP41.00C1.B03
    SMC Version (system):    1.27f1
    Any help would be GREATLY appreciated.

    I am not familiar with InDesign Interchange, do you think this will help?
    That's why I suggested it. But you didn't answer my question: Is this happening with only one file? The reason I ask is because if one file is corrupted, saving to INX and back to INDD often clears out minor corruptions. If you're seeing this in many files it's unlikely they're all corrupt.
    1. Convert text using paragraph styles - I meant modified "placed" text using character styles
    Now I'm really confused. Your steps are:
    Place document from Word in to InDesign document
    Highlight table to be changed
    Modify placed text using character styles
    Are you really highlighting an entire table and applying a character style? While this will work to modify certain formatting aspects, it's not really the best approach. Character styles are for characters *within* a paragraph. Paragraph styles are for *entire* paragraphs. Each table cell contains at least one full paragraph, even if it's just a single number, a space, even if there's nothing there at all. If you want to format the contents of an entire cell or range of cells with the same formatting, use a paragraph style, not a character style. If you want to italicize one or two words in some text in a cell (the way I just did), then use a character style.
    I really feel that the issue either stems from fonts or from placing the document from Word.
    Could be. Cheap fonts are the cause of many problems in Indesign. Indesign is really picky about fonts. But let's try the easy fix first (INX). If you don't trust it, save the .inx to a new .indd filename (keep your old .indd file as a backup).
    Ken

  • Find and replace a table style

    I have about 10  table styles in a document and I want to replace all of them with the #1 table style. Can this be done with Find and Replace?

    You'll need to do this for each of the Table formats that need to be replaced.
    Let's assume the desired format is "Format A" (a default FM style), and one of the formats to be changed is "Specs 2".
    Click in any instance of a Specs 2 table.
    In the Table Tag field, pull down and click on [Format A].
    Click Commands > Global Update Options:
    (*) All Properties
    (*) All Tagged [Specs 2]
    [Update]
    If it works properly, you'll get a dialog:
    OK to change all Format B tags to Format A?
    [OK]
    Additional global updates may be required to clean up any overrides.
    Trying this on FM7 at home, it didn't always work. I don't know if newer versions are more stable. Personally, I never do it this way (probably because of prior experience), and I usually just hack the MIF.

  • Separate table title autonumbering for two named table styles?

    I believe this very same question whizzed by a few weeks ago but I'm having no luck searching for it.
    I have two named table styles.  I want the autonumbering for the table titles to be separate.  More specifically, one will autonumber as "Table t", while the other will autonumber as "Example e".
    I have redefined the autonumbering counter for the second of the two TableTitle para style, and if I apply that style while in that table's title, I get the new autonumbering.  But I can't transmit (a) selectively update the Table Title style to this format to other tables in the chapter.  By extension, I can't copy the  wonderful new table format to other chapters in the book.
    I next tried creating a new para style "ExampleTitle", then in the Table Designer trying Update All.  Nope, other tables of type example do not receive the new title style.
    This is fully-patched FM8.  The document is structured but I don't (want to) care about that -- I simply need to get the two different named table styles
    to autonumber sequentially.
    This is probably pretty easy once I learn the "trick"...(?)
    Cheers & thanks,
    Riley

    Arnis:
    Thanks.  For some reason I couldn't get my table to update, so I went through and manually create a second table title paragraph style, then manually applied that.  (I also created a second x-ref format so that I could x-ref to "Example n:" without including the colon in the x-ref, but that's another story...)
    So for now I've worked around the problem.  After I get this document out I'll revisit the issue.  (Why do I have a vague recollection that there's a known idiosyncracy where FM6+ table styles don't update properly...?)
    Cheers & thanks 'gain,
    Riley

  • Can't "Define default table style"

    I am trying to define how a new table gets inserted into my document. I can set the header text formatting, table body formatting, table text etc just fine, go to format>advanced> define default table style but I cannot seem to get the table borders the way I want.
    I am trying to have ONLY horizontal table borders appear on a newly inserted table. It seems you only have a choice of ALL borders or NO borders in the table body... not any variation in-between.
    Anybody seen this issue or know of a workaround?

    Okay, did everything you suggested: Cleared caches, rebooted, checked disks, permissions, etc. (all was fine as I am very meticulous about keeping my Mac in a pridstine state... no junk, hacks, minimal 3rd party bits etc.)
    This is what I did:
    1 Launch pages
    2 Choose blank template
    3 Type a few letters of text
    4 Save file
    5 Insert table
    6 Click outside table, then once on table so that it has the four square "handles"
    7 Pages Graphic Inspector - change stroke to none
    8 Click the horizontal lines button in table inspector
    9 Graphic Inspector - change Stroke to the line
    10 Click outside table, then once on table so that it has the four square "handles"
    11 Format>advanced> define default table
    12 Table lines re-appear
    13 adding a new table shows all lines, not just horizontal
    I tried with different templates (Blank, CV, etc)
    I created a new user and tried it there
    This occurs both on a 20 inch iMac and a 12' 867 Powerbook. It's strange that other people can apparently do it and I can't.
    mac 10.4.2, Pages 1.0.2

  • Can this be done with table styles?

    Hello,
    Can someone tell me if this table layout is possible to achieve with table styles? Specifically the first column being slightly darker is proving a problem with the alternating rows, I feel like I need a 'column style' option but there isn't one (in CS5) that I can see. Thanks very much.

    Sans cell styles, this Javascript adds 20% to the tint of cells in the very first column for each table. It does not change header rows (and on 2nd thought, maybe it shouldn't do footer rows either).
    .. Without trying, I couldn't tell what happens with complickated merged cells. The document I'm working on contains 8 tables, but the idiotic author pasted them as figures into Word. All of my scripting prowess can't work around that ...
    tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (t=0; t<tables.length; t++)
    processTable (tables[t]);
    function processTable (table)
    var i, cells = table.columns[0].cells;
    for (i=table.headerRowCount; i<cells.length; i++)
      cells[i].fillTint += 20; // percentage to add

  • Table Styles flyout is blank

    I used to have table styles created so I could quickly color my tables. Now, my table style box is blank with none of the icons along the bottom to create new or delete. Even when I reload styles from a previous document or create a new one, it doesn't show in the box. The styles show when I try to import them but the don't show up in the current document.
    Any ideas why this stopped working correctly and how do I get it back? I deleted my preferences to set Adobe back to default and that didn't work either.
    Any help is appreciated. Thanks!

    Yesterday I tried the method of renaming the two files and starting ID. Didn't work...same problem. This morning I couldn't take it anymore and used the keyboard method (SHFT-CTRL-ALT at startup). Knowing I'd lose my desktop layout, which is the biggest customization I had in place, I had already taken a screen capture. But it was worth it. The keyboard command to delete preferences worked! I do love this forum! Thanks for all the help!

  • How to extract inline styles from a PDF document using Acrobat 9?

    I have a requirement for extracting all the contents along with the para level and character level styles from a PDF document in the form of XML. While doing so I'm getting lot of additional tags. In addition to that I'm not able to find the inline tags (character level tags) like bold, italics, superscripts etc and the page numbers. It would of great help if someone can throw light on this.
    Thanks.

    Moved to Acrobat Forum.

  • The appearence of tables in some Word 2010 documents changes after KB2880529

    I wanted to alert you that, since our company has applied
    KB2880529, some users are reporting Word 2010 documents (docx) having their appearence changed.
    More precisely, the issue concern the table inserted in the Word document : They are all messed up. For exemple, the begining of the table can look ok, then a few lines of the table are
    badly miss aligned (like moved 2 cm to the right), then you've got a few normal lines, then again several bads, and so on.
    Also, some of the cells, that were in the last column of the table, may appear half outside of the table.
    And the worse part is that, even if you take some time to manualy fix the table, when you save the document and re-open it, everything is bad again, and exactly as it was before... so basicaly
    the save doesn't work for the tables (it work if you change some text in the table, but not for the table itself (size of the columns, location of the columns, so on)).
    I can't profite any file because they are of a very sensitive nature and can't leave our company, even if I remove most of the content, our IT security doesn't allow it.
    Anyway :
    - we are absolutly sure it's
    KB2880529 that does that because when we uninstall the KB, and re-open the document, it look normal again.
    - it seems to concern only documents that were created using some old Word 2003 templates some time ago, and then opened in Word 2010. As far as I know it doesn't happens on 100% Word 2010
    documents.
    So, we are currently doing a package installed by SCCM 2012 in order to uninstall it on all the PC which received it a few days ago.
    Let's hope you'll correct that issue... and if possible that, in a near futur, you'll had a feature in SCCM 2012 to allow us to unintall KBs, like it was possible with WSUS.

    I'm sure there are some ways to fix the files one by one. Indeed, our tests indicate that it's possible, for exemple, to open them in "LibreOffice 4.2" (a fork of OpenOffice), which displays them correctly, and then save the file in .doc and then use
    Office 2010 to open this .doc and save it in .docx.
    But what I've forget to indicate is that the issue touch probably thousands of documents that have been placed in a "document management application" (I'm not sure how to correctly translate) over the years, documents that may be hundreds of users need to
    look at, for reference, from time to time... but basicaly the documents are "frozen" / archived, they must not be edited by anybody.
    I very much doubt you can expect MS to not apply updates, including via the next Service Pack, just because some tables in some of your documents are corrupt. Besides which, the same problem will quite likely resurface when you next upgrade to a newer version
    of Office. Ultimately, someone is going to have to check out all the documents with tables and verify their content. The scope of that project might be narrowed down after you've checked a few documents and found some common features between those with the
    corrupt tables. It's easy enough to write a macro to test the files to see which ones have tables. That can serve as the first step in narrowing the scope of the project. It's also possible have the macro that repairs the files restore their
    original time/date stamps if that's important.
    An entirely different approach would be to temporarily uninstall the update on one PC. Then use that PC to convert all the documents to PDF. Then use the PDFs in the "document management application". Since the documents "must not be edited by anybody" the
    PDF format is inherently more secure in that regard and can have security attributes set to prevent printing and/or content copying. The PDF format is also impervious to Word's tendency to change document layouts whenever you do little things like updating
    printers or changing between doc & docx formats.
    Cheers
    Paul Edstein
    [MS MVP - Word]

  • Why are objects in tables removed when opening a document (created in pages 2009) in the new pages?

    I have a problem: Documents I created in Pages 2009, when opened in the new Pages I get "objects in tables were removed".
    This makes all my documents useless !
    Is there any way to get the objects (images and tables mostly) to load into the tables across all my documents ?

    No, there isn't. Use Pages 09 with your old documents and Pages 5.0 for creating new ones. Do you really need Pages 5.0 is the question you need to answer. If not, don't.

  • Table styles in RH don't transfer to Word 2010

    In RH, I have defined a table style called top-row-shaded, and have mapped this style for delivery to Word, in word-template.dot file. All RH tables of style top-row-shaded shoud map to my Word template style top-row-shaded, but they don't.
    Does anyone kmow a fix?
    If not, does anyone have a word macro that can convert my tables to the  top-row-shaded style in the Word file?
    My RH file has another table style (called no-border) that I don't want to convert, so I can't simply apply the style to all tables in the Word file.
    Thanks, Joanne

    Without setting up a test, I'm not sure why the tables are not mapping. By all means see the Contact page on my site and send me a one topic project and the Word template. I will take a look but it will be at least a week or so before I can.
    Meantime there is a macro on my site that will need editing that will find each table and then allow you to apply changes or skip to the next table.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Can the cell lines be removed from a table inserted in a Pages document?

    Can the cell lines be removed from a table inserted in a Pages document?

    Inspector > Table > Table > Cell Borders
    The buttons immediately below "Cell Borders" allow you to choose left, right, inside, outside etc.
    Choose None from the border style Pop-up.
    Download the Number'09UserGuide from the Help menu in Pages. Search for borders.
    Regards,
    Ian.

Maybe you are looking for