Setting width of the table text frame script

Hello


I need to capture my table cells within the "Width of the text frame" option with "Distribute column evenly", when it goes beyond the "width of the text frame. Is it possible by script?


by

hasvi

Hi Hasvi,

Try this.

var doc = app.activeDocument,
    _tables = doc.stories.everyItem().tables.everyItem().getElements(),
    _tfwidth, _cells, finalwidthofcell;

for(var i =0;i<_tables.length;i++)
{
        var currentwidth = 0;
        _tfwidth = _tables[i].parent.geometricBounds[3] - _tables[i].parent.geometricBounds[1];
        _cells = _tables[i].rows[0].cells;
        for(var j=0;j<_cells.length;j++)
        {
                currentwidth +=_cells[j].width;
            }
        if(currentwidth > _tfwidth)
        {
                finalwidthofcell = _tfwidth/_cells.length;
                for(var k=0;k<_cells.length;k++)
                {
                        _cells[k].width =finalwidthofcell;
                    }
            }
    }

Kind regards

Cognet

Tags: InDesign

Similar Questions

  • [JDev12.1.2, ADF] af:table - why do setting AutoHeightRows reduce the width of the table?

    Hallo,

    my table must have a height of 20 lines.

    So I set AutoHeightRows = 20 but... when I run the application from the width of the table it is reduced by half, and the first fields are displayed.

    Where I'm wrong?

    Thank you

    Federico

    After setting the AutoRowHight to 20 make the StyleClass "AFStretchWidth", and it will work.

    Not sure if this is a bug or a feature.

    Timo

  • Set the width of the table for TableView

    I create a new TableView with a few columns and I am trying to set the width of the entire table. I searched the API, but it only gives me setMaxWidth. I tried but it didn't work. Can anyone suggest me how to set the width of the tables.

    I do this:

    private TableView < XYZ > table = new TableView < XYZ > ();

    table.setMaxWidth (600);
    table.setLayoutX (15);
    table. Resize (40, 40);

    But nothing has really changed width of the entire table.

    Thank you.

    Column resizing policy is what you are looking for.

  • Control of the width of the table for printing

    Is there a way I can use Dreamweaver, maybe say 850 pixels with CSS, to add a table to my site that is configured for a fixed width, but that the text inside the table correctly when printing envelope? I know that beyond about 760 pixel fixed-width tables cause the text flow out of the page when printing to some browsers, and we usually control this using a percentage to determine the width of the table. In this case, however, we like to use a fixed width when the content is displayed on the screen, but is fixed the text wrapping when printing before reaching the right margin of the table width. Make sense?

    you need to distinguish which style sheet is used for printing like this:


  • How do I get the width of the table?

    Hello

    pls someone tell me, how do I get the width of the table?

    Thank you

    Vijay

    Try,

    InterfacePtr tableGeometry (tableModel, UseDefaultIID());

    PMReal tableWidth = tableGeometry-> GetColWidths (0,-> GetTotalCols () .count tableModel);

  • How to change the width of the table of results LOV

    Hello
    I have several lov defined on the attributes of display objects. The LOV renders correctly, but if add more columns to the list of attributes resulting display of table always displays bars scroll if they don't fit within the default width of the table of results. How can I increase the width of the table of results so I can show all display both attributes?

    Kind regards
    André Jochems

    Hello

    guess it needs a new skin picker because there is no option to do this. I played with skinning and finally with

    AF | table {width: 500px}
    #departmentId_afrLovInternalTableId::scroller {width: 500px}

    The ID selector is what I disovered debugging page. I guess that ID always starts with the name of the field to be updated, "departmentId" in my case

    I'll drop and ER, what kind of count is fragile

    Frank

  • Flexible, set up including the tables and columns of text?

    I need to set up tables (annual report) and some text between the two notes.

    I would like to have frames as little as possible on every page - for InCopy workflow later.

    If I paste the text of the regular column in the frames containing the tables anchored that I must apply the shift of different basis for each block of anchor text, text which is not a nice workflow.

    Can you recommend a skillful means and flexible to set this place that will make the tables and text boxes flows if more lines or more text are added?

    Best regards

    Nina storm

    For this test I did it manually, but I have no reason to think that it would behave differently as part of a style. As far as I know, ID will attempt to balance the two columns automatically. If there is not enough text to divide into two columns it will not appear to divide but always see you any extra spacing and add just enough text to be wider than the column width of Courland and your line will have a gap in it for the gutter of the column.

    OK, I've just defined a style with the attribute of split, and Yes, it works in the same way. If you have a single paragraph, the paragraph is divided. If you have more than one, the block is divided, reading down by the first paragraph to the second (assuming that the linecounts work that way) in the first column before splitting into the second column. Paragraphs distributed individually. ID is to balance my columns automatically and will adjust the break if I edit, and if the number of rows is not divisible by 2 short column is on the right.

  • set the width of the table header

    I have a fairly simple VI that resizes columns in a listbox MC based on the size of the text. The only thing I do not know how to implement is including the row headings. I don't see a property to set the width of the row header cell. Suggestions?

    Column = - 1

  • Cannot set the width of the table

    I created a master / detail page set and it seems to work very well, but I'm having a problem with the layout for the master and detail pages. The generated code creates a table that extends to the part right of the page and is too broad. I tried to adjust the table width and the widths of the columns, but these seem to be either ignored or supplanted. The master page is here http://hollisterairshow.com/feedback-suggestions-master.php and as you can see the number 9 of the feedback is far too broad in the master and detail pages.

    I don't see all the CSS settings that might cause these problems. I would really appreciate some pointers on where to find the next. I use Win XP / IE8, but the same problem occurs with Firefox v3.5

    Thank you

    Tony Babb

    You have added the attribute of the table-presentation to thetag and the

    Tag, not thetag.

    CSS attributes generally apply to specific tags. Some, such as the width, widely apply to many tags. Others, such as table-layout, are very specific. Search for the correct use of a CSS property online before applying.

    The table-layout CSS attribute applies to the

    Tag:

    http://www.w3schools.com/CSS/pr_tab_table-layout.asp

    http://www.w3.org/TR/CSS2/tables.html#width-layout

    So add

    #maincontent table {}

    table-layout: fixed;

    }

    Once in your style sheet.

    This rule is all

    tag inside an element with id = "maincontent".

  • How to set the width of the input text

    Hello


    I form, which have little input text.the layout of the form is not correct.some input text is so long, it's hard to do in any seizure of text the same length. Some inputtext have varchar2 (1000). How do I?

    Hello

    first of all to mention the jdev version that you are working

    In the input text is property called columns. You can give a value such as 200 or 300 according to your need.

    Try this.

  • In the tables tab stops script

    Is it possible to refer to tab stops in a script? I can't find anything about it.

    I have the notes that need to occur at the bottom of each table that the symbols or abbreviations are used in this table. Because the cells can not be resized independently, it is difficult to get the same spacing. So I use tabs to create "virtual" columns

    Here's how I do it manually:

    1 merge all the cells in the row.

    2. Enter the notes.

    3 take note of the width of the merged column.

    4. determine how many tab stops are needed.

    5. set each center-aligned tab.

    Thus, a column of 6 "to scale with three notes would have to 1 ', 3' centered tab stops and 5. It looks like three columns spaced text.

    I would be able to enter the notes and then run a script to determine the correct tab stops. I could either select or define a paragraph style that you could find the script.

    Thank you!

    Ryan

    Remember that tabs are the text properties. Everything you need is there to do. There is even a property tabsList that you can use to set all tabs in a single shot.

    Dave

  • How to resize the width of the table programmatically?

    Hello

    I have a table with a change number of columns dynamically. Is it possible to set the width of the entire table and change the width of the columns by program? Something like property activates a cell: size: width of the listbox?

    Thanks in advance.

    Errata:

    There is a possible way to change the size of the elements; See this KB for this request.

    hope this helps,

    Norbefrt

  • I'm not able to get the value of an element in the region from the table using Java script

    I have a fixation with two columns area, when the user tries to add a new line without having to fill in the line above, then it should throw an exception. It is the custom page and the home region is located at the end of my page so normal exception raises at the top of the page where the end user referred to in the current. I need to go with popup warning. I built a java script in PR

    code:

    OkButton OASubmitButtonBean = (OASubmitButtonBean) webBean.findChildRecursive ("addrow");

    okButton.setOnClick ("javascript: a = document.getElementById ('prompt');" + "alert ('outside ' + (a.value));" +)

    "if ((a.value)! = ") {input = alert ('check' + (a.value)) ;}} else {alert (' inside the else'+ (a.value));} ");"

    The code above works for entering the message text in the header area, but it is does not make any value if the sub-region of table in advance. Kindly share your point of view on this issue.

    attach_js_issue.png

    This code will give you the same ID only.

    Check the "View Source" code generated from the browser.  https://support.Google.com/AdSense/answer/181951?hl=en

    See you soon

    AJ

  • Reading properties on the linked text frames

    Hello

    I need to be able to get the background color and a background image of a textframe help of scripts. I can't find anything in the documentation on the subject. Suggestions?

    Also, I need to test if one or more linked text frames are connected to each other. Suggetions?

    Thanks in advance

    Bo Dudek

    WebDeveloper

    Mediegruppen

    To test if a block of text is linked to another, use the nextTextFrame and previousTextFrame:

    if (myFrame.nextTextFrame === null && myFrame.previousTextFrame === null) {
      // the frame is not linked to another frame
    }
    

    Background color: myFrame.fillColor

    Background image of a block of text: is a picture behind a block of text?

  • width of the hot text push down of elements?

    Hello

    Is there a way to make a text box - reactive width checked-pushing down of items below text when reducing the width of the browser?

    Thank you

    Igna

    This little video of hope can help you, I think it's that Artem.NewLife meant when you say "join".

    I had the same problem when resizing the browser everything messy. By grouping the text + image of BG and 'Fixing' of the group in the text before all in place. Again, I have to do some more tweaking with the text IN the group, but thought to share with you while I'm.

    See you soon!

Maybe you are looking for