Applescript/Pages and adjusting column width (and paragraph style)

I was hoping that some someone might know how to adjust the width of individual columns in Pages using Applescript. It seems like it should be a simple task, and I can adjust the overall width/height of the table, but I haven't found a way to adjust the column width. Alternatively, I could have the program create the table in Numbers and copy/paste it into Pages, but I'd imagine that would get a bit messy and wouldn't allow me to use a hanging indent in the cells (to the best of my knowledge).
Also, is there a way to adjust the paragraph style used by the text in the table? Otherwise, I could just use a templet and define the the default table style appropriately. (Though not the most elegant solution).
Thanks in advance for your help!
(In case it helps, the script I'm working on parses an unformatted inventory and parses it into paragraphs/tables.)

Try this:
set tableCount to 0
--open file to be pased here, excluded for example
tell application "Pages"
    activate
    set theDoc to (make new document)
    tell theDoc
        --makes paragraph styles used
        make new paragraph style with properties {name:"Folio", font name:"Times New Roman", font size:12, bold:true, alignment:left, space after:5, keep with next paragraph:true, space before:15}
        make new paragraph style with properties {name:"Place", font name:"Times New Roman", font size:12, bold:false, alignment:left, line spacing type:relative, line spacing:100}
        make new paragraph style with properties {name:"Description", font name:"Times New Roman", font size:12, bold:false, italic:true, alignment:left, line spacing type:relative, line spacing:100}
        make new paragraph style with properties {name:"Table", font name:"Times New Roman", font size:12, alignment:left, left indent:0.5, first line indent:0.0}
        --begin repeat, gathers MS info from one doc (unformatted) and writes it into another with formatting, setting variables directly for example
        set MSName to "new Manuscript"
        set MSPlace to "place where MS is stored"
        set MSDesc to "description of MS"
        set tableData to {{"folio", "title", "composer"}, {"", "subtitle", ""}, {"etc", "next", "next"}}
        --write paragraph information from earlier
        set currentPar to (make new paragraph at end of paragraphs with data MSName)
        set paragraph style of currentPar to "Folio"
        set currentPar to (make new paragraph at end of paragraphs with data MSPlace)
        set paragraph style of currentPar to "Place"
        set currentPar to (make new paragraph at end of paragraphs with data MSDesc)
        set paragraph style of currentPar to "Description"
        --create table, add data, and format
        tell application "System Events" to tell process "Pages"
            key code 125 using {command down} -- move the insertion point to the end
            tell menu bar 1
                -- Insert a new table:
                click menu item "Table" of menu 1 of menu bar item "Insert"
                -- Delete the header row:
                tell menu 1 of menu bar item "Format"
                    click menu item "Delete Row" of menu 1 of menu item "Table"
                end tell
                -- Show the Inspector:
                tell menu 1 of menu bar item "View"
                    if menu item "Show Inspector" exists then
                        click menu item "Show Inspector"
                    end if
                end tell
            end tell
            tell window 1 -- the Inspector window
                click radio button 7 of radio group 1 -- select the Table Inspector
                perform action "AXRaise" -- activate the Table Inspector
                tell tab group 1 of group 1
                    click radio button "Table" -- select “Table”
                    -- Reduce width of all three columns:
                    repeat 3 times
                        set value of text field 2 to "0.5 in"
                        set focused of text field 2 to true
                        keystroke return
                        keystroke tab -- next column
                    end repeat
                    key code 126 -- the Up Arrow
                    -- Set width of each column:
                    repeat with theValue in {"0.75 in", "4.25 in", "1.5 in"}
                        set value of text field 2 to theValue
                        set focused of text field 2 to true
                        keystroke return
                        keystroke tab -- next column
                    end repeat
                    key code 126 -- the Up Arrow
                end tell
            end tell
            keystroke "i" using {option down, command down} -- hide the Inspector
            -- Add the data:
            repeat with i from 1 to 3
                set thisRow to item i of tableData
                repeat with j from 1 to 3
                    keystroke (item j of thisRow)
                    if (i * j = 9) then exit repeat
                    keystroke tab
                end repeat
            end repeat
        end tell
        set tableCount to tableCount + 1
        tell table tableCount
            select
            set stroke width to 0.0
            set wrap to center
            set name to MSName
        end tell
        --after which it would continue with the next MS and repeat the process until all are done
    end tell
end tell

Similar Messages

  • Why can't you adjust column width in pages for ipad?

    Why can't you adjust column width in pages for ipad?

    It's just one of the many, many features that have been removed. It all appears to be deliberate, not an oversight. Leave feedback for the Pages team using the link in the Pages menu.

  • Adjusting Column Widths Via the CSS in 6.5+

    It is pretty easy to adjust column widths in the CSS on 6.5+
    One issue that we encountered that was slightly trickier (for non-css folks like me) was ensuring that the columns were set at 100% for the 2 column layouts.
    The below code will set the narrow columns on 2/3 column layouts to be 200px wide, and ensure that the wide column maintains 100%
    .columnOne               { text-align: left;}
    .columnTwo               { text-align: center; }
    .columnThree               { text-align: left;width:200; }
    .layoutOneColumn               { table-layout: auto; }
    .layoutOneColumn .columnOne     { width: 100%; }
    .layoutTwoColumnNarrowWide     { table-layout: auto; }
    .layoutTwoColumnNarrowWide .columnOne          { }
    .layoutTwoColumnNarrowWide .columnOne .portletBody     {  }
    .layoutTwoColumnNarrowWide .columnTwo .portletBody     { background-color: #FFFFFF; }
    .layoutTwoColumnWideNarrow               { table-layout: auto; }
    .layoutTwoColumnWideNarrow .columnOne .portletBody     { background-color: #FFFFFF; }
    .layoutTwoColumnWideNarrow .columnTwo          {width: 200; }
    .layoutTwoColumnWideNarrow .columnTwo .portletBody     { width: 200; }
    .layoutThreeColumn                    { table-layout: auto; }
    .layoutThreeColumn .columnOne               { }
    .layoutThreeColumn .columnOne .portletBody          {  }
    .layoutThreeColumn .columnTwo .portletBody          { background-color: #FFFFFF; }
    .layoutThreeColumn .columnThree               { }
    .layoutThreeColumn .columnThree .portletBody          {  }
    /* Set the invisible image */
    #portletColumnFormatter_0 img {width:200px;}
    #portletColumnFormatter_1 img{width:100%;}
    #portletColumnFormatter_2 img{width:200px;}

    I don't understand?  I launch PSE 9 from the task bar.  This is the screen I get.
    I've tried right clicking everything I can think of w/o success.
    Once I click "organize", it's too late.  The organizer is coming up.
    Maybe I don't know for sure what the "Organizer icon" is or where it is?  Or, maybe I shouldn't start it from the task bar?

  • Visual Composer 7.2 SP3 - Adjust column widths of ALV tables by end user

    Hello,
    we're using ALV tables with values coming out of function modules and queries.
    Unfortunately I can't see an opportunity to adjust column widths at runtime by the end user. This is in contrast to VC 7.0 using flex.
    Is there a way to archieve this?
    Kind regards
    Stefan

    Hello Stefan,
    This is a feature of Webdynpro Flex runtime. You can adjust column widths at Flex runtime in 720 SP3 also.
    This is not supported by Webdynpro HTML runtime.
    Regards,
    Talia

  • Improve the implementation of graphic and paragraph styles

    The implementation of Graphic and Paragraph Styles should be more consistent:
    You can currently edit the attributes of paragraph styles (e.g., point size) but not of graphic styles (outer glow). With graphic styles, you have to overwrite the existing style rather than edit it.
    Graphic Styles have the concept of "breaking the link" whereas Paragraph Styles don't.
    Add the ability to select objects based on a paragraph style (yes, you can select based on Attribute, but not all objects with a specific paragraph style).
    Combine graphic and paragraph styles. For example, I want a style with a 12 pt font and an outer glow.

    Same thing happening here.
    You can though first create some type with a 12 point stroke , then define a new paragraph style, and even though it says 10pt will apply 12pt.
    If you have not looked into graphic styles, that might be a better option for stokes. You can
    Move the fill on top of the stroke (allows you to use a different color for stroke, so the orignal sahep of type doe not get squeezed)
    Use multiple strokes aroudn type
    Set the corner options to round
    For appearance & graphic style, the secret to type is to first set your type fill and stroke to none (this removes the stylization at the character level), then apply strokes and fills in the appearance palette at the type level only. This way the stylization won't fight with each other.

  • Page break as part of a paragraph style?

    Hello,
    is there a way to add page break as part of a paragraph style? I'd like for my "Heading 1" to always start on a blank page.
    Thanks!

    Use the keep option in the style for the heading itself. Set to start on next page, next odd page, or next even page. The following paragraph style should be set to start anywhere.

  • Pages and Numbers on iPad 2 crashes when I adjust column width

    This is a problem that just started this morning: whenever I select a column or row in either Pages or Numbers the application closes. Any recommendations? I have tried forcing a shut down of Pages and Numbers, and restarting my iPad.

    I called Apple support. I forced all apps to quit, uninstalled the app, restarted my iPad and had same problem. I also took my iPad into the store where I got it. They came to the same conclusion: 1) do a back-up to the cloud, 2) delete all settings and data, 3) restore from iCloud--this took several hours to do. Good luck.
    I had just updated about 14 apps when the problem started.

  • Portal Report from SQL query will not fill the page irrespective of column width.....

    I'm displaying a report in a portal and if you run in full screen the table does not fill the page.
    I can change the column width from xx percent to xx pixel and nothing makes a difference
    any ideas?

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

  • Auto adjust column width in multicolumn listbox

    Hi
    May I know, does multicolumn listbox has a function / control to auto adjust the column width?  If not, how can I solve this problem, as user could not view the full data if the width that I set is too small. It would be annoying if the user need to adjust it manually each time they get the data from database....
    Any advise??? TQQQQQ......

    Hello 222,
    I've already seen a few threads about "auto adjust multi-column listbox column width", as far as I can remember, there is not such option in LV 7.1 (I don't know about LV 8).
    Meanwhile I think there are option that can allow the user the modify column width at runtime. This plus an horizontal scrollbar should be the alternative... I know it is not "perfect" for the user.
    You also have the possibility to do a function that will compare the string length to the column width, and to programatically increase the width if needed.
    Personnaly I wouldn't go for this but this is your choice
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • How to adjust Column width using SHD0 for FB60

    Hi,
    How can adjust ( i have to reduce the length) Assignment filed in the FB60 transaction using SHD0.
    Please help in this regard.
    Regards,
    Kishore

    HI,
    I think you can adjust the column width and save it as Screen Variant in the SHD0.
    When you create a screen variant for the MIRO, adjust your column width and position than save it the variant. Once you save and activate the variant, it will appear in the Layout dropdown box on MIRO.
    OR
    Please check in spro with ur functional consultant to explore if the field can be made not mandatory..
    menu path:
    AR and AP -> Customer Accounts -> Line Items -> Display line items -> display line items without ALV

  • Adjusting column width

    Where can I modify the column width for a page? I want to present several regions across columns 1,2, and 3.

    Hi,
    You can enter style in your query like that :
    select row1,
    '<span style="margin-right:100px;">'||row2||'</span>' row2
    from dual;
    With this style, the row2 will be more wide than the row1.
    Sylvain Michaud
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

  • Tagging character styles and paragraph styles in inDesign

    I'm working on a complex book in which everything on the pages is styled.
    I've been asked to tag the vocabulary terms in the text, so that the correct page number shows up in the index.
    I've been asked to tag the folios as well, for the table of contents.
    The folios are a paragraph style.
    The vocabulary terms are styled with a character style.
    How do I do this?
    Any help much appreciated.

    InDesign's built-in Table of Contents function picks up text based on paragraph styles. I'm not sure you really men, though, that you want to pick up the folios, if you are using the term as I understand it, to mean the page numbers. You really want to pick up the various headings used to identify the topics or titles. ID will supply the page numbers.
    As for the indexing, there may be a script that can find text with a particular character style assigned and add it to an index (you should ask over in the scripting forum: InDesign Scripting) but you should also read the Help on Indexes and learn more about how they operate.

  • How to adjust column width Sheet to Go?

    Does anybody know how you can increase the column width in Sheet to Go?
    Eugene
    My PlayBook App: Checklists

    With the new Playbook 2.0 update and the docs to go app, I found that when in Excel, tap on the column header, (where it has the column identified as A, B, C, etc.), the whole column will be highlighted in blue and you will notice that on one side of the column header is a double line. Simply place finger on the header and slide to desired width. Tap outside of the column to return to the document.

  • Gylphs and paragraph styles in InDesign CS4

    When I insert a character from the glyph palette, it doesn't retain the paragraph style. For example, I'm using Minion Pro and inserting the fraction for one half. The fraction inserts, but then the paragraph style has a plus sign which indicates a change to the paragraph style. What's causing this?

    Well I tested it myself before posting. The Glyph from the Glyphs panel is using a different style set than that in ther paragraph style.
    You can see this yourself if you make a Fraction with fractions turned on and also insert a glyph.
    Use File>Export and choose InDesign Tagged Text. Open the Tagged Text file in notepad or similar and search for "fraction" and you'll see that the style sets are different.
    When I tested it in InDesign the Paragraph override didn't come on when I unchecked the style sets in the Paragraph Style.

  • Two columns with footnotes page and paragraph that continues is not correctly tag (for accessibility

    When I have a document with two columns in indesign CS5.5 and footnotes page. If there's a note in the first column, the paragraph that begins in the second column is not correctly tag. This is shown with an automatic tag <P>, and with this symbol "¶"
    Why?
    How I can I solve it?
    thanks

    Hi John,
    My page is not a part of a task flow. The whole app is an Admin app comprising of multiple individual pages navigated using Menu.
    I have tried to run this page individually on my local machine as well as when deployed on the WLS server. The behavior is the same.
    Kindly advice,
    Thanks,
    Ram

Maybe you are looking for

  • Transporting table entries present in standard SAP R/3 table u201CTMCEXCFZu201D.

    Hi All, We have a requirement where in we need to capture a table entry in transport request in R/3. The table "TMCEXCFZ" is a standard SAP R/3 table. The" transport entries" option under the "table entry" in menu bar is disabled in our case. Is ther

  • I own a Canon 6D and just bought Photoshop CS6 and I am not able to open my raw images into Photoshop CS6. What do I do to fix this?

    I own a Canon 6D and just bought Photoshop CS6 and I am not able to open my raw images into Photoshop CS6. I downloaded the camera raw and dng converter for it, but realized in the process that the one I downloaded does not work with my Mac version,

  • Mail downloads on old iMac and iPhone but not new iMac

    Just bought a new iMac. Transferred all the settings. However if I download my email from my old iMac it won't show up on the new one unless I check it on the new machine first. Can I get all my mail accounts to download all my messages? ie I don't w

  • An error in Script Logic

    Hi Experts, I have a problem with one of the FXTranslation logicu2019s in one of my report can u please help me on that. The logic works fine for 2 reports out of 3, for the 3rd report I donu2019t know why itu2019s not doing the translation to USD. A

  • Redirect on image click

    I have a report on a page. In that report I am displaying an image using an SQL Statement. I want to redirect to another page when the user clicks on the image. I have tried creating a link under "Column Link" for this image but when I do that and ru