dynamic resizing of columns too wide (javascript, CS5)

Hey. I'm just starting to writing scripts for InDesign (and realize how I've been losing in recent years too much time). So far I managed to solve the minor issues myself, but this one I don't know enough to make round. I appreciate that what is needed for the solution is probably a pretty great piece of code, so I'm grateful for any advice you can give, just did he hint or nudge in the right direction.

What I have is this little piece of code that comes if applies a style of cell for all tables in the selected block of text:

var myTextFrame = app.selection [0];

var myTables = myTextFrame.parentStory.tables.everyItem ();
var myTableCells = myTextFrame.parentStory.tables.everyItem ().cells.everyItem ();

myTableCells.appliedCellStyle = "NameOfCellStyle";

What I have to do here is looking for one of the tables of myTables which:

(1) are wider than myTextFrame (i.e., wider than the text block, they are in)

(2) have exactly two columns

(3) have a first column wider than the second column

In these tables, the first column should be resized so that the table fits exactly inside myTextFrame.

The best solution would be a dynamic resizing is not dependent on the specific numbers, because the size of myTextFrame may vary, but right now I'll settle for what it is, even if it means the creation of several scripts for text different widths of chassis.

So there. After too many attempts failed, resulting in large part of me having very little evidence of what I'm doing, I'm about to give up. Any help or advice is greatly appreciated.

Thank you

Let's go top a step at a time.

for (s=0; s

If your tables have lines on the outer edge, zoom in! The right side of the resized table is inside the text frame, but his race is on the outside. If this is a problem, you probably have to subtract the thickness of the line of the available width as well. (I don't usually have this problem, because most of the time, my paintings is outline.)

Tags: InDesign

Similar Questions

  • Start menu columns too wide

    How can I change the column width in my Start menu in XP?  I can't see all my programs?

    The width is determined by the length of program names. If you rename the longer to shorter names, the columns will be narrower. You can easily add at least one visible column if not two by doing this. Bruce Hagen ~ MS - MVP [Mail]

  • Bookmarks drop down the list too wide Firefox Mac OSX Lion 31

    When I click on the drop down bookmarks menu, it's too wide. If there is a folder in the contents list shown far right. At the point where I'm moving the mouse on there where the contents of the folder is it disappears. Am on Mac OSX Lion. I tried to scroll on the corners and sides of the drop down list to search again for the sizing handles, but none are. It is not just Firefox 31 version as has happened for some time. Any ideas please?

    Which may be caused by the presence of a few bookmarks with a long title in the main menu of bookmarks.
    The width of a column in the list of bookmarks is in the current versions of Firefox automatically adjusted the bookmark with the longest name.
    You can check the names of the bookmarks and the longer more short.

  • Dialog box confirm boxes are too wide for the page and disappear on the right side in the sites we develop. It's new. How to fix?

    In Windows and Mac confirmation dialog boxes are open now too wide. It extends on the right side of the page and therefore mask the user action buttons. The site has no horizontal scroll bar.

    When you resize the browser window, the dialog box has scaled to the correct size. As website developers, how can we prevent what happens?

    May be this bug:

    • bug 686469 - tab-modal alert can extend beyond the browser window

    (please do not comment in bug reports)

  • resize unique columns of table front panel

    I have a bunch of columns on my front and some of them contain lon channels, while others have only a maximum of 2-3 strings in them.

    I'm looking for a way to resize each column without resizing all the others at the same time. If I have them all the same length and the length of the string max I get the table is much too large to fit on the screen space and navigation in labview VI leaves much to be desired.

    His cosmetic event but would help me see clearer information and as the information are all locked in long strings his does not work well with what im doing then.

    Watch multicolumn ListBox or tables. They allow the customization of the column widths and are specially designed for user interfaces.  Protect your data in a table to the schema for the treatment, but the indicators on the front panel.

    Lynn

  • Dynamic number of columns in the table

    Hello

    I use JDev 10.1.3.3.0 with ADF. I just want to create a table, with a dynamic number of columns in the table. The background is that a user of my webapplication can create and submit a sql query. Now, I have to show him the results. My idea was, I have save the result in a bean managed (ResultTable), which is stored in the session context and map at my table in my page.

    If I search the Forum and don't get only one useful thread: {: identifier of the thread = 971888}, but I don't exactly understand. What is the CollectionModel? Do I need this?

    I'm trying to report on the following:

    ResultTable
    public class ResultTable {
    
        public static final String SESSION_NAME = "ResultTable";
        private ArrayList<ResultColumn> columnList; 
        private CollectionModel collectionModel;
    
        public ResultTable() {
        }
    
        public ArrayList<ResultColumn> getColumnList() {
            return columnList;
        }
    
        public void setColumnList(ArrayList<ResultColumn> columnList) {
            this.columnList = columnList;
        }
    }
    ResultColumn
    public class ResultColumn {
        
        private ArrayList<ResultRow> rowList;
        private String name;
    
        public ResultColumn() {
        }
    
        public ArrayList<ResultRow> getRowList() {
            return rowList;
        }
    
        public void setRowList(ArrayList<ResultRow> rowList) {
            this.rowList = rowList;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    ResultTable
    public class ResultRow {
        
        private String value;
    
        public ResultRow() {
        }
    
        public String getValue() {
            return value;
        }
    
        public void setValue(String value) {
            this.value = value;
        }
    }
    My showResult.jspx
    <af:table emptyText="No items were found"
              value="ResultTable.columnList"
              var="column"
              varStatus="colStatus"
              id="table1">
      <af:forEach items="#{column.rowList}" var="row" varStatus="rowStatus">
        <af:column sortable="false" headerText="#{column.name}" 
                   id="column#{colStatus.index}">
          <af:outputText value="#{row.value}"
                         id="outputText#{rowStatus.index}"/>
        </af:column>
      </af:forEach>
    </af:table>
    The ResultTable was filled with data, but the Board is not filled. So, I think, it must be rejected to the data binding.

    I get warnings and errors to run too. But I don't know if they are the result or cause of my problem.
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.renderkit.core.xhtml.TableRenderer renderTableWithoutColumns
    WARNUNG: Table with id: form1:table1 has no visible columns!
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:span does not match start name:div
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:span does not match start name:div
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:form does not match start name:span
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:body does not match start name:form
    27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
    SCHWERWIEGEND: Element End name:html does not match start name:body
    Concerning

    Majo

    Hi Mario,.

    
      
        
          
        
      
    
    

    Note that your JSPX snippet above has serious shortcomings:

  • 'ResultTable.rowList' is not an EL expression, but the value attribute of the af: table must refer to an EL expression
  • Items AF:foreach = "#{row.cellList}"-you don't have to store information about the columns of all rows, more it won't work as af:forEach tag may not see the value of the expression of EL #{line} (or any component EL expression created). " See the tagdoc here: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/forEach.html
  • "ID =" Column #{cellStatus.index} "and id =" outputText #{rowStatus.index} "are invalid and that they don't compile even as id attributes cannot contain EL expressions.

    .

    I think to solve your problem, you need three things:

  • List of columns (for example the list If you need to store only the names of column or list If you need additional information),.
  • list of lines,
  • a line can be a map (with the name of the column - cell data mapping; card e.g.) or a list (with columns indexed; for examplelist).

    Example with the lines of the map:

    JSPX snippet:

    
      
        
          
        
      
    
    

    The ResultTable bean:

    public class ResultTable {
    
        private List columnList;
        private List> rowList; 
    
        public ResultTable() {
        }
    
        public List getColumnList() {
            return columnList;
        }
    
        public void setColumnList(List columnList) {
            this.columnList = columnList;
        }
    
        public List> getRowList() {
            return rowList;
        }
    
        public void setColumnList(List> rowList) {
            this.rowList= rowList;
        }
    
    }
    

    Type ResultColumn:

    public class ResultColumn {
    
        // additional fields if needed...
        private String name;
    
        public ResultColumn() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    

    AF:table display correctly after the initialization of the values in your beans properly filled ResultTalbe (e.g. to fill the list of rank with the lines).

    Hope this helps,
    Patrik

  • Why all the elements pull appears too wide for example back and before the arrows on the browser are oblong do not round?

    Pictures are too wide, too long words and circles are not round but oblong.

    Then you don't have to set correctly for your screen resolution. The picture you describe seems to indicate that your computer is configured for a square screen (or almost) but whether you are viewing on a widescreen monitor. Monitors Electronics is stretch the square image to fit the screen.

    Right-click on an empty part of the screen, then select the screen resolution. The values in the resolution box should be the same as the specification of the screen, but click on the arrow and look for the recommended option.

    The main reason why it does not work if you don't well loaded graphic drivers as this can block the questioning of the screen to set the resolution.

  • Dynamically resize images on a webApp list page

    Hello world

    I used the following code to dynamically resize images for a webApp event list page:

    < img src = "{tag_image list_value}? Action = thumbnail & width = 384 & height = 253 & algorithm proportional ="/ >

    It works perfectly but when I click on the image, it is not a link to the event details page.

    Adding dynamic code I got the following only:

    list {tag_image}

    This made the image and when you click on it it went to the detail page, then is it possible to revise the dynamic code so that it renders an image which, when clicked, navigates to the page of detail?

    Would be very grateful for any advice.

    Thanks in advance.

    You encapsulate your image in an html anchor where the attribute href has the tag url for this layout in it.

  • Too wide display sequence

    I must have screwed something up, but I don't know what.

    I have two settings: 720 x 480 and 640 x 360. They are defined in the actual size of the images used. It worked fine before (and works in an old file - but if I import it into a new file - there still the same issue).

    It is that the display of these sequences is WAAAAAAAAAAAAAAAAAAAY too wide. I have huge black bars on the side - and, Yes, they export this way. I don't know why it is so wide when it is SUPPOSED to be as noted earlier and said it is in the info, but clearly, this isn't when it is such that it makes the images look almost square a rectangle long and lean. : S

    Help? I can not any work done until this problem is corrected.

    It seemed to me have solved the problem by removing all the adobe folders created auto, a reboot and one from a new project. Don't know what part fixed, but it works now.

    Thanks anyway. The video was good info even if I don't solve my particular problem.

  • Dynamic resize TextArea without scrollbars

    There is an example of a text box dynamic resizing without scrollbars on the link below, but it does not work with htmlText, only normal text.

    Any suggestions on what are the changes to the code to make it work with htmlText?

    It's link with the example:

    http://www.Adobe.com/cfusion/CommunityEngine/index.cfm?event=ShowDetails & postId = 13628 & Prod = 2 uctId

    Thank you.

    Maybe this:
    package components {}
    import flash.events.Event;
    Import mx.controls.TextArea;
     
    SerializableAttribute public class DynamicTextArea extends TextArea {}
    public void DynamicTextArea() {}
    Super();
    super.horizontalScrollPolicy = 'off ';
    super.verticalScrollPolicy = 'off ';
    this.addEventListener (Event.CHANGE, adjustHeightHandler);
    }
    private void adjustHeightHandler(event:Event):void {}
    trace ("textField.getLineMetrics (0) .height:" + textField.getLineMetrics (0) .height);
    If (height<= textfield.textheight="" +="">
    height = textField.textHeight;
    validateNow();
    }
    }
    override public function set htmlText(val:String):void {}
    textField.text = val;
    validateNow();
    height = textField.textHeight;
    validateNow();
    }
    override public function set height(value:Number):void {}
    if(TextField == null) {}
    If (height<=>
    Super.Height = value;
    }
    } else {}
    var currentHeight:uint = textField.textHeight + textField.getLineMetrics (0) .height;
    If (currentHeight<=>
    If (textField.textHeight! = textField.getLineMetrics (0) .height) {}
    Super.Height = currentHeight;
    }
    } else {}
    Super.Height = super.maxHeight;
    }
    }
    }
    override public function get htmlText (): String {}
    return textField.text;
    }
    override public function set maxHeight(value:Number):void {}
    super.maxHeight = value;
    }
    }
    }
  • How to dynamically add a column to the DataGrid

    Hey there everyone. Forgive me, I'm very new to this.
    I use a data grid to display values analyzed in an xml file.
    The application needs of 5 columns, no problem, however, if a value is present in the xml file, I need to add another column.
    If I have a var defined as
    var gps_present which is a string, and if the value == 'Yes' adds a column in my datagrid?

    < mx:DataGrid id = "summary_grid" x = "10" y = "15" width = "500" height = "434".
    dataProvider = "{summary.lastResult.phones.phone}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "phone number" dataField = "phone number" width = "3" / >
    < mx:DataGridColumn headerText = "inc_java" dataField = "inc_java" width = "3" / >
    < mx:DataGridColumn headerText = "inc_sms" dataField = "inc_sms" width = "3" / >
    a logic here if inc_gps == 'y '.
    < mx:DataGridColumn headerText = "inc_gps" dataField = "gps" width = "3" / >
    < / mx:columns >
    < / mx:DataGrid >


    Thank you for any advice on that.

    nephish,

    Yes. Sorry, displaying large blocks of code on the forums is a little tricky. Posted an example here: http://blog.flexexamples.com/2008/03/04/dynamically-adding-new-columns-to-a-datagrid-contr ol in flex /

    Hope that helps,
    Peter

  • When I click on the restore, the button, the page Web is suddenly too wide and I can't settle it with the black arrows.

    Two hours ago, it was fine, but now it won't let me adjust the width when I restore to the bottom of pages. The width is currently half of the screen, which is too big for what I do. The black two-headed arrow appears, but it wont let me make the finer Web page. I can make it wider, however, but not what I need.

    There is a minimum width. Users have reported different values, ranging from 374 to about 400 pixels. If you need a window smaller than the minimum width, please see these discussions for how to replace the integrated with a smaller minimum:

  • Find and replace (CS6) results: column too narrow location

    When I use search in the find and Replace window, the location of the results column is too narrow to be useful, and I can't make it any wider, despite plenty of room in the window.  See screenshot:

    FlashCS6_FindandReplace.jpg

    I use Flash Pro CS6 v12.0.2.529 on Mac OS X 10.7.4.

    It is a frustrating problem.  Is there a solution?  If this isn't the case, should I file a bug report?

    Thanks, ~ jason

    I thought about it.  The 'Type' column width was maximized in some way.  I need click and drag on the right border of the column to make it smaller.  Then there was room to make the 'Place' and 'Put in correspondence of the elements' more wide.

    Just weird.

  • Dynamically resize Flex Layout

    I use flex inside a coldfusion page and would like to know how dynamically my swf in height to fit my request.

    I have a search application and the details text to cut. now, I could scroll but would like to be able to extend the height of the swf to my page of browser can scroll. Is this possible?

    I thought about Application.application.height but nothing. I don't know that the code is up to the page that resizes, but if I put this at 100% can not I put the variable within my application?

    Help, please!

    LinkMc,
    If you use the standard model it has css which says:
    Body {margin: 0px;} { overflow: hidden }<- take="" out="" the="" overflow:hidden.="" that="" is="" the="" first="" step.="" there="" is="" also="" a="">". I pulled the scrolling = 'no' just to be sure. I found myself by wrapping javascript code in the page in a

    . Then I put the height to the size of the app. When the application is shrinking and develop, I adjust the height so the footer is not all simply sit at the end of a lot of scrolling.
    AS3--> flash.external.ExternalInterface.call ("adjustDivHeight", "950");

    Also, a few issues I've seen with IE. The list never ends.

    If we've detected an acceptable version
    embed the Flash content SWF when all tests are passed
    AC_FL_RunContent)
    'src', 'acuminderFX ',.
    "width", "762."
    "height", "100%."
    "align", "middle",
    'id', 'acuminderFX ',.
    'quality', 'high ',.
    'bgcolor', '#ffffff ',.
    'name', 'acuminderFX ',.
    "flashvars", "base = https://www.jnjvision.com/',"
    "allowScriptAccess", "sameDomain",.
    'type', "application/x-shockwave-flash"
    "pluginspage", "https://www.adobe.com/go/getflashplayer."
    "wmode", "transparent".<-- get="" rid="" of="" ie="" black="">
    );

    In IE the swf appears as a black square until de on it with the mouse.
    This emphasizes the swf so that IE will take control.
    var acuFxObj = document.getElementById ("acuminderFX");
    If (acuFxObj! = null) {}
    acuFxObj.focus ();
    }

    If you look at https://www.acuminder.com/ you can see what I did to make it work. Also because obviously I had to make a few changes to the history.js. IE does not load if you does not solve the history.js

    This should be a good start.

  • Dynamic resizing of a sprite (image hotspot)

    Hello

    I have a question about scale dynamically a sprite. I have an application that displays a picture on the screen, and on top of that image, I draw dynamically semi-transparent sprite who act as hot spots for the image under.

    I can't understand how to evolve hotspots in proportion to the part of the image that the scales located below. Hotspots extend UIComponent (so I can communicate with them) and they contain a sprite that is the Visual hotspot on the screen (which is good).

    The image below is a simple Image. When I resize the image (resizing the window), I would like for the hotspots to stay where they are related to the image.

    I tried to create another component, which extends the class Image that attracts all the hot spots and then tried to put it on the top of the image (understand I could put the content of true as the image scale), but had the same results (hot spots were fired, but did not react to the resizing whatsoever).

    Should I use the Bitmap class to draw hotspots instead? I have no idea at this point. I'm puzzled. Any guidance would be appreciated. May I approach the evil of all this, I don't know at this point. I hope I explained the problem well enough to get some kind of feedback.

    Thank you very much for your time.

    Hi Amy,

    I thought about it. I kept pounding on your idea of using a canvas on the scale the UIComponents as a group, but it did not work because I have been scaling the canvas based on the properties of the image (the under Layer) that were not resolved (I tried to recover after Event.ADDED_TO_STAGE).

    The solution was to wait for the Event.RENDER shot and then get the dimensions of the image loaded, to understand what is the percentage of the size that the resized image of the original image and then just scale the canvas above this one session to match. Sprinkle in a listener for Event.RESIZE and boom, it works like a champ.

    This method works better than I expected because now it doesn't matter what size of the original image is relative to its container (larger or smaller), it will scale itself and all its layers (layer of canvas) together.

    It seems that several times I'm looking for the right place for my solution (in the API), just at the wrong time (usually too early, before the properties I'm looking are defined).

    Thank you very much for putting me on the right track.

    The f

Maybe you are looking for

  • Could not find back arrows

    I used to have arrows to go back and forth. For reasons unknown, they disappeared. This has happened Each time Firefox opened Is a few days ago

  • Input analog FPGA and scale of output

    Hello world I'm looking at the code of the analog and exit entry in the example file. Why the signal at the analogue output is first divided by 10 and multiplied by 32768 and the signal at the entrance is first divided by 32768 and then multiplied by

  • DVD player will not play recent blue-ray movies

    When I insert a recent blue-ray movie, I wonder if I want to update, or not. When I press Yes, then the player does nothing. I have

  • Windows Vista loop start

    Hello I went to a laptop on a field, but was pressed and thus check/didn't know not it is Windows Vista Home Premium. After it is joined to the domain and click the restart now button the laptop restarts. Unfortunately, Windows is not started, instea

  • Multiple copies print IE9 and Word on HP Laser Jet 4250N

    Why this keep happening?  It's random, and I don't know how to stop it.