Setting alignment of cell content in jtable??

hi,
does anybody know how i can set the content of my jTable cells to the center of each cell. thanx, mischa.

Did you search the forum???
Using keywords "+jtable +center" would be a good place to start.

Similar Messages

  • Problem in  alignment of cell content in Advanced Table

    Hi,
    I have a column which has some flag say 'Y' or 'N'.
    I have created an advanced table and followed the dev guide for aligning the value in the center of the cell.But i m getting null pointer exception when I m using getColumnFormats method of advanced table.
    OAAdvancedTableBean resultsTableBean =(OAAdvancedTableBean)webBean.findChildRecursive("region2");
    System.out.println("index"+pageContext.findChildIndex(resultsTableBean,"column1"));
    OAColumnBean manuPartNoCol =(OAColumnBean)webBean.findChildRecursive("column1");
    manuPartNoCol.setAttributeValue(ALIGNMENT_GROUP_ATTR,ICON_BUTTON_FORMAT);
    resultsTableBean.prepareForRendering(pageContext);
    // now get a handle on the array of Column Format Dictionaries
    DataObjectList myColumnFormats = resultsTableBean.getColumnFormats();
    System.out.println("myColumnFormats.getLength"+myColumnFormats.getLength());
    // get a handle on the specific Column Format Dictionary you
    // are interested in
    oracle.cabo.ui.data.DictionaryData myIconColumnFormat = (oracle.cabo.ui.data.DictionaryData)
    myColumnFormats.getItem(pageContext.findChildIndex(resultsTableBean,"column1"));
    // set the CELL_NO_WRAP_FORMAT_KEY property to TRUE
    myIconColumnFormat.put(COLUMN_DATA_FORMAT_KEY , ICON_BUTTON_FORMAT);
    BUt if I use table bean instead of advanced table bean then the same code works.
    Basically i have to set the alignment of the cells in the advanced table bean in the runtime.
    Can anybody suggest something?
    Thanks

    Provide the error stack.
    --Shiv                                                                                                                                                                                                                               

  • TableView cellfactory set style based on content from another cell

    I'm trying to figure out how to set the color of the current cell based on the content from another cell or property in the class that contains the row content. I looked at the following thinking I can use this but the table position method is not longer there.
    ((Person) t.getTableView().getItems().get(t.getTablePosition().getRow())).setLastName(t.getNewValue()); // from a oracle tableview javafx example
    I would like to:
    if (((Person) t.getTableView().getItems().get(t.getTablePosition().getRow())).getRowError())
    cell.setStyle("..."); // Set the color of the cell content
    Is there away to get the underlying object from the setcellfactory call method?

    Does
    t.getTableView().getItems().get(getIndex())give you access to the object represented in the current row? The getIndex() method is a TableCell method (inherited from IndexedCell).

  • Change the default setting of 'Match entire cell contents' in Excel 2007

    Hi,
    I am using Excel 2007 on Windows 7 and need to search the contents of cells in a large spreadsheet on a regular basis.
    When I open the Find and Replace dialogue box, the Match entire cell contents option is always checked. I deselect this to search for the cell contents I require. If I then enter any values into a cell and try to search for another cell,
    the Match entire cell contents option is activated again.
    Is there a way to change the default setting for this checkbox to be off rather than on?
    Thank you,
    Nitin Suneja

    Hi Chad,
    I will check if it is something localised to the spreadsheet itself as it is shared by a number of people and all are having this problem with this sheet.
    Thanks for looking into this for me.
    Nitin.

  • Getting right end of text displayed in cells of a JTable column

    Hey All,
    Platform: WinXP, Java 5.0.
    I have a simple one-column table whose cells contain pathnames of user-selected files. The pathnames may be quite long, and when they're too long for the fixed width of the column (the containing JFrame is not resizable), I want the trailing (right) end of the pathnames to visible (so the filenames are visible) and for elipsis to be used on the left side (omitting root directory, etc., if need be). I can't figure out how to do this. I've tried many different approaches. Currently I use a class that extends TableCellRenderer, but no combination of alignment settings in this class seems to do the trick.
    I've noticed that in the case of JTextFields, this manner of display seems to be the default, no matter what alignment setting I choose. I can't seem to get the desired effect with the display of cells in my JTable though.
    Anyone have any suggestions?
    Thanks in advance.

    Great job camickr,
    That did just what I wanted; you get the points for sure! I will say that It's surprising to me that Swing leaves so much work in calculation to be done for this simple idea.
    Btw, I also want to mention here that there's another forum issue I raised and you responded to recently, and you never quite answered my question there:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5160875
    That's got 10 pts riding on it too, if you care to revisit the issue...
    Thanks very much for the good work on the CellRenderer.

  • HELP: delete cell contents on select

    Hi All
    I would like to delete a cell's contents as soon as the user selects it. Otherwise it takes to long to delete the default values before you can enter the new ones.
    Does anybody know how I can accomplish this?
    Hope to hear from you soon.
    Comlink

    If you set the column cell renderers this way the cells will be put in edit mode when the user entres the cell and the cell will be selected.
    For each column in the table
    for (int i = 0; i < numberOfComumnsInTable;i++ ) {
      column=PassportTable.getColumnModel().getColumn(i); // Get column
      column.setCellRenderer(new DefaultTableCellRenderer() { // Set cell renderer for column
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
          Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (hasFocus && isSelected && isCellEditable(0, i)) { // put cell in edit mode
            table.editCellAt(row, column);
            table.getEditorComponent().requestFocus();
            TableCellEditor tableCellEditor = table.getCellEditor(row, column);
            Component c = tableCellEditor.getTableCellEditorComponent(table, table.getValueAt(row, column), isSelected, row, column);
            ((JTextComponent)c).selectAll();
          return renderer;
    }rykk

  • Table Cell Contents Disappears Please HELP!!!!

    PROBLEM: I have a different tables within different table cells in the Master table. One table per Master cell. Once I click on a table cell (0,0) and click on another table cell (1,1) the cell (0,0) blanks out. Likewise with other cells so that if I've click on all the cells in the Master Table and then clicked somewhere else all cell contents have disappeared.
    QUESTION: Do I need to call some UI refresh procedure????? I have a cell renderer which returns the table for each Master's Cell.
    I don't if this is clear but please help!
    Thanks

    Hi,
    the problem is that the DefaultCellEditor can't handle tables.
    So you have to write your CellEditor, which returns another table as Editor.
    class YourTableCellRenderer implements  TableCellRenderer{
        private  JTable table = new JTable();
        public Component getTableCellRendererComponent(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row,
                                                       int column){
             // set Data and Layout
             return table;
    }then set the Editor to your MasterTable (master) with.
    master.setCellEditor(TableCellEditor anEditor) or
    master.setDefaultEditor(Class columnClass,
                                 TableCellEditor editor);Hope this Helps.
    Michael

  • Drag and Drop of cell content between 2 tables

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Guys,
    Iam into implementing drag and drop of cell contents between 2 different tables,say Table1 and Table2.(Iam not dragging and dropping rows or cells,Just copying the content of one cell to another).
    Have extended the java tutorial class "TableTransferHandler" and "StringTransferHandler" under http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo to satisfy my needs.
    The drag is enabled for Table1 and table2 as follows.
    jTable1.setDragEnabled(true);
    jTable1.setTransferHandler(new TableTransferHandler());
    jTable2.setDragEnabled(true);
    jTable2.setTransferHandler(new TableTransferHandler());
    Dont be taken aback with the code I have put.It just to show what I have done..
    My questions are put at the end of the post..
    //String Transfer Handler class.
    public abstract class StringTransferHandler extends TransferHandler {
        protected abstract String exportString(JComponent c);
        protected abstract void importString(JComponent c, String str);
        protected abstract void cleanup(JComponent c, boolean remove);
        protected Transferable createTransferable(JComponent c) {
            return new StringSelection(exportString(c));
        public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
        public boolean importData(JComponent c, Transferable t) {
            if (canImport(c, t.getTransferDataFlavors())) {
                try {
                    String str = (String)t.getTransferData(DataFlavor.stringFlavor);
                    importString(c, str);
                    return true;
                } catch (UnsupportedFlavorException ufe) {
                } catch (IOException ioe) {
            return false;
        protected void exportDone(JComponent c, Transferable data, int action) {
            cleanup(c, action == MOVE);
        public boolean canImport(JComponent c, DataFlavor[] flavors) {
              JTable table = (JTable)c;         
             int selColIndex = table.getSelectedColumn();
            for (int i = 0; i < flavors.length; i++) {
                if ((DataFlavor.stringFlavor.equals(flavors))&& (selColIndex !=0)) {
    return true;
    return false;
    }//TableTransferHandler classpublic class TableTransferHandler extends StringTransferHandler {
    private int[] rows = null;
    private int addIndex = -1; //Location where items were added
    private int addCount = 0; //Number of items added.
    protected String exportString(JComponent c) {
    JTable table = (JTable)c;
    rows = table.getSelectedRows();
    StringBuffer buff = new StringBuffer();
    int selRowIndex = table.getSelectedRow();
    int selColIndex = table.getSelectedColumn();
    String val = table.getValueAt(selRowIndex,selColIndex).toString();
    buff.append(val);
    return buff.toString();
    protected void importString(JComponent c, String str) {
    JTable target = (JTable)c;
    DefaultTableModel model = (DefaultTableModel)target.getModel();
    //int index = target.getSelectedRow();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    target.setValueAt(str, row, column);
    protected void cleanup(JComponent c, boolean remove) {
    }Now I want to put in the following functionality into my program...
    [1]prevent dragging and dropping text in to the same table.That means I dont want to drag a cell content from Table1  and drop to another cell in Table1. Want to drag and drop cell content only from Table1 to Table2.
    [2]Change cursor on a un-defined Target. That means how to prevent a drag from a particular column in Table1.Also how to prevent a drop to a particular column in Table2. How to change the cursor to a "NO-DRAG" cursoror "NO-DROP" cursor.
    Could it be done using Drag Source Listener and drop Target Listener?.
    If yes,How can these listeners attached to the table and how to do it?
    If No,How Could it be done?
    [3]Want to change the background colour of the cell being dragged and also the background colour of the target cell where the drop is made...
    [4]Is there any out of the box way to make an undo in the target cell(where drop was made) so that the old cell value is brought back.
    How can I extend my code to take care of the above said things.
    Any help or suggestions is greatly appreciated.....
    Edited by: Kohinoor on Jan 17, 2008 10:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How do I change the colour of text in a cell in a JTable?

    I am trying to change the color of the text in a single cell in a JTable. I have tried not adding a cell renderer and it changes the colour of text in all cells.
    I have tried adding a cell renderer to the table and it does the same ie all cells text colour changes.
    I am able to add a cell renderer to a column and it changes all the cells in the column.
    I cannot figure out how to change just one single cell's text colour without effecting the other cells.

    Ok, so if i create my own cell renderer do I set it as the default renderer for the whole table i.e.
    table.setDefaultRenderer(MyCellRenderer, renderer);
    Does this set one cell renderer for the whole table or is there an individual one for each cell?

  • How do I change the colour of a selected cell in a jTable?

    I have a Jtable that displays URL names in one column. There are several problems I'm having. The effect I'm trying to achieve is this:
    When the user runs the mouse over the URL name the cursor should change into a hand (similar to what happens in an HTML hyperlink). I'm aware that the Cursor class can set the cursor graphic so i figure that i need a listener of some sort on each cell (so the cursor can change from an arrow to a hand) and also one to indicate when the cursor is not on a cell (so that it can change from a hand back into an arrow). Is this the right track?
    Also, I've looked at the DefaultTableCellRenderer class (which, as i understand it, is responsible for how each cell in the jtable is displayed) for a method that will allow me to set the background of a selected cell (or row or column). I require this because each time i select a cell (or row) it becomes highlighted in blue. I would rather it just remained white and changed the cursor to a hand. I know there exists a method for setting the background for an unselected cell but none for a selected cell. Again, I'm not sure if I'm going down the right track with this approach.
    Lastly, if the cell has been selected (by a mouse click) the font of the writing in the cell (i.e. The name of the URL) should change. This shouldn't be too much of a problem I think.
    I do not expect anyone to provide code to do all of this but some general pointers would be extremely helpful as I do not know if I'm thinking on the right track for any of this. Having some (limited) experience with Swing I doubt there is a simple way to do this but I can only hope!
    Thanks.
    Chris

    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    there you can find some examples with CellRenderer's and so on ...
    have fun

  • Space in table cell content

    Hi,
    I want to add some space before and after the table cell content. I am using setIntercellSpacing() method to achieve that and I could get the required functionality. But its adding space in the Table Header also which looks odd. Is there any way to set the spacing only for the cell and not for the table header.
    Let me know if anyone has solution for this.
    Thanks and Regards,
    R.Vishnu Varadhan.

    I find this behaviour of setIntercellSpacing() very annoying, too. Why the hell did the Swing developers implement it that way?
    Nevertheless, you can create the desired effect by writing a custom cell renderer, but that is if course more work than that single method call.

  • Centre Align Web Page Content

    Hi,
    Need some help center aligning web page content when it maximizes or is resized. I have grids, panels, etc and want these to center on page.
    Is there a property of the page/body/head/form/div that can be set for this or is javascript required to achieve this.
    Any help mcuh appreciated.
    SNI

    Hi,
    I tried what the thread did and still cannot my layout panel to center align.
    This is my jsp line:
    <ui:panelLayout binding="#{Login.pnlLogin}" id="pnlLogin" style="height: 306px; left: 382px; top: 216px; text-align: left; vertical-align: middle; width: 100%; -rave-layout: grid; horizontal-align: left;">

  • Customizing the Cell Content of a Pivot Table

    Hi,
    I have been away from ADF for a few years (since 10g v 1.3.1) and am quite impressed with all the Faces functionality added to the 11g release. The application I wrote relied heavily on pivot tables which back then, I had to use stored procedures in the database and dynamically views to display information. I am very interested in moving this application to 11g and taking advantage of the PivotTable component. One thing the application does is change the style of cells based upon the object being presented. I have been reading:
    Oracle® Fusion Middleware
    Web User Interface Developer's Guide for Oracle Application
    Development Framework
    11g Release 1 (11.1.1)
    B31973-03
    And am very interested in section 26.8 Customizing the Cell Content of a Pivot Table.
    I easily created a pivot table and would like to change the formatting of various cells. I created a backing bean for a test page and added the Example 26–4 Sample Code to Change Style and Text Style in a Pivot Table to the bean.
    public CellFormat getDataFormat(DataCellContext cxt)
    CellFormat cellFormat = new CellFormat(null, null, null);
    QDR qdr = cxt.getQDR();
    //Obtain a reference to the product category column.
    Object productCateg = qdr.getDimMember("ProductCategory");
    //Obtain a reference to the product column.
    Object product = qdr.getDimMember("ProductId");
    if (productCateg != null && productCateg.toString().equals("Sales Total"))
    cellFormat.setTextStyle("font-weight:bold")
    cellFormat.setStyle("background-color:#C0C0C0");
    else if (product != null && product.toString().equals("Sales Total")
    cellFormat.setTextStyle("font-weight:bold");
    cellFormat.setStyle("background-color:#C0C0C0");
    return cellFormat;
    Almost verbatim except changed the literals to select data in my use case domain. My question is: How do I invoke this message from my pivot table? I need to pass it a instance of the DataCellContext. The example is great and illustrates what I am looking to do but does not go into the implementation details required. Is there a sample app available for download that demonstrates these capabilities?
    Thanks,
    Jeff
    Edited by: jcapzz on Jun 9, 2011 3:56 PM

    Hello,
    I haven't fully understood your question.
    Is it: How do I call the getDataFormat() method from my pivot table?
    If so , you need to set the dataFormat attribute of your pivot table.
    ex: <dvt:pivotTable id="pt2" var="cellData" varStatus="cellStatus"
    value="#{bindings.YourView.pivotTableModel}"
    headerFormat="#{viewScope.yourBean.getHeaderFormat}"
    *dataFormat="#{viewScope.yourBean.getDataFormat}"*
    contentDelivery="immediate" pivotEnabled="false"
    columnFetchSize="-1" rowFetchSize="-1"
    />
    I also put the *headerFormat* attribute which allows to customize the headers
    I hope I understood your question ;)
    Jack

  • Duplicate Cell Contents n-times based on value in neighboring cell?

    I have a sheet/table that contains ~150 rows of 2 columns:
    A B
    COUNT CONTENT
    I am looking for a way to duplicate each CONTENT in a new sheet/table COUNT times, and do this for each row.
    For example
    A B
    2 RED
    1 BLUE
    3 GREEN
    Would give me a sheet/table that contains one column that reads:
    RED
    RED
    BLUE
    GREEN
    GREEN
    GREEN
    Any ideas? Thanks in advance.

    Here is a modified version .
    (1) I added comments helping you to understand its behaviour.
    (2) added a property (use_GUIscripting) allowing you to choose the script's behaviour.
    - if you use GUI scripting, the set of datas is inserted in the table as a whole.
    - if you doesn't use it, the values are inserted one by one which is a bit slower.
    So I decided to give you freedom. You may make your own choice.
    --[SCRIPT buildand_fill_newtable]
    Enregistrer le script en tant que Script : buildand_fill_newtable.scpt
    déplacer le fichier créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Merci à Scott Lindsey & Ed.Stockly du forum [email protected]
    qui m'ont aidé à construire le code récupérant le bloc sélectionné.
    Sélectionner le bloc de cellules contenant les paramètres à utiliser.
    aller au menu Scripts , choisir Numbers puis choisir buildand_fill_newtable
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    +++++++
    Save the script as a Script buildand_fill_newtable.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    une_valeur you would have to create the folder Numbers and even the folder Applications by yourself.
    Thanks to Scott Lindsey & Ed.Stockly from [email protected]
    which helped me to build the code grabbing the selected range.
    Select the range of cells containing parameters to use.
    go to the Scripts Menu, choose Numbers, then choose buildand_fill_newtable
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/09/02
    -- added comments and ability to choose between use GUIscripting and doesn’t use it
    --=====
    property use_GUIscripting : false
    true = use GUIscripting and paste values
    false = doesn't use GUIscripting
    property theApp : "Numbers"
    property les_valeurs : {}
    property nouvelles_valeurs : {}
    --=====
    on run
    local dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2, le_nombre, la_valeur
    if use_GUIscripting then my activateGUIscripting()
    my nettoie()
    try
    Extract infos about the source range *)
    set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    tell application "Numbers" to tell document dName to tell sheet sName
    tell table tName
    Extract the values of selected cells *)
    set my les_valeurs to value of cells colNum1 thru colNum2 of rows rowNum1 thru rowNum2
    --> {{2.0, "bleu"}, {3.0, "blanc"}, {5.0, "rouge"}, {1.0, "vert"}, {4.0, "noir"}, {6.0, "violet"}}
    end tell -- table
    repeat with une_reference in my les_valeurs
    set {le_nombre, la_valeur} to contents of une_reference
    repeat le_nombre times
    copy la_valeur to end of my nouvelles_valeurs
    end repeat
    end repeat
    --> {bleu, bleu, blanc, blanc, blanc, rouge, rouge, rouge, rouge, rouge, vert, noir, noir, noir, noir, violet, violet, violet, violet, violet, violet]
    Build an unique name for the new table *)
    set nouveau_nom to (do shell script "date +table%Y%m%d%H%M%S")
    if use_GUIscripting then (*
    Create a small new table *)
    make new table with properties {name:nouveau_nom, row count:3, column count:3}
    else (*
    Create a new table with the needed rows *)
    set rows_needed to count of nouvelles_valeurs
    make new table with properties {name:nouveau_nom, row count:rows_needed + 1, column count:3}
    end if
    As the default table has header row an header column, remove such items *)
    tell table nouveau_nom
    remove row 1
    remove column 1
    set selection range to cell "A1"
    end tell
    end tell
    if use_GUIscripting then
    --> the handler 'recolle' concatenate the values of the list nouvelles_valeurs in a text with values separated by return character.
    bleu
    bleu
    blanc
    blanc
    blanc
    rouge
    rouge
    rouge
    rouge
    rouge
    vert
    noir
    noir
    noir
    noir
    violet
    violet
    violet
    violet
    violet
    violet
    set the clipboard to my recolle(my nouvelles_valeurs, return)
    Triggering the menu item paste the entire set of values in a single task *)
    my selectMenu("Numbers", 4, 7) (* Paste Applying Style *)
    else
    Here we aren’t using GUI scripting so we must fill cells one by one. *)
    tell application "Numbers" to tell document dName to tell sheet sName to tell table nouveau_nom to tell column 1
    repeat with r from 1 to rows_needed
    The coercion as text is required to get rid of a Numbers bug. If the system doesn’t use decimal comma,
    inserting AppleScript decimal numbers (which use the decimal period) inserts a value like 12.34 which is treated as a string.
    If we coerce as string, the cell receive 12,34 which is correctly treated as a number *)
    set value of cell r to item r of nouvelles_valeurs as text
    end repeat
    end tell -- Numbers…
    end if
    end try
    Clear properties so that their contents will not be stored in the script. *)
    my nettoie()
    end run
    --=====
    on nettoie()
    set my les_valeurs to {}
    set my nouvelles_valeurs to {}
    end nettoie
    --=====
    set {rowNum1, colNum1, rowNum2, colNum2} to my getCellsAddresses(dname,s_name,t_name,arange)
    on getCellsAddresses(d_Name, s_Name, t_Name, r_Name)
    local two_Names, row_Num1, col_Num1, row_Num2, col_Num2
    tell application "Numbers"
    set d_Name to name of document d_Name (* useful if we passed a number *)
    tell document d_Name
    set s_Name to name of sheet s_Name (* useful if we passed a number *)
    tell sheet s_Name
    set t_Name to name of table t_Name (* useful if we passed a number *)
    end tell -- sheet
    end tell -- document
    end tell -- Numbers
    if r_Name contains ":" then
    set two_Names to my decoupe(r_Name, ":")
    set {row_Num1, col_Num1} to my decipher(d_Name, s_Name, t_Name, item 1 of two_Names)
    if item 2 of two_Names = item 1 of two_Names then
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    else
    set {row_Num2, col_Num2} to my decipher(d_Name, s_Name, t_Name, item 2 of two_Names)
    end if
    else
    set {row_Num1, col_Num1} to my decipher(d_Name, s_Name, t_Name, r_Name)
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    end if -- r_Name contains…
    return {row_Num1, col_Num1, row_Num2, col_Num2}
    end getCellsAddresses
    --=====
    set { dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    on getSelParams()
    local r_Name, t_Name, s_Name, d_Name
    set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
    if r_Name is missing value then
    if my parleAnglais() then
    error "No selected cells"
    else
    error "Il n'y a pas de cellule sélectionnée !"
    end if
    end if
    return {d_Name, s_Name, t_Name, r_Name} & my getCellsAddresses(d_Name, s_Name, t_Name, r_Name)
    end getSelParams
    --=====
    set {rowNumber, columnNumber} to my decipher(docName,sheetName,tableName,cellRef)
    apply to named row or named column !
    on decipher(d, s, t, n)
    tell application "Numbers" to tell document d to tell sheet s to tell table t to ¬
    return {address of row of cell n, address of column of cell n}
    end decipher
    --=====
    set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers" to tell document 1
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    try
    (selection range of table y) as text
    on error errMsg number errNum
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    return {theDoc, theSheet, theTable, theRange}
    end try
    end repeat -- y
    end if -- x>0
    end tell -- sheet
    end repeat -- i
    end tell -- document
    return {missing value, missing value, missing value, missing value}
    end getSelection
    --=====
    on parleAnglais()
    local z
    try
    tell application "Numbers" to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    on decoupe(t, d)
    local oTIDs, l
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to oTIDs
    return l
    end decoupe
    --=====
    on recolle(l, d)
    local oTIDs, t
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to oTIDs
    return t
    end recolle
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    my selectMenu("Pages",5, 12)
    ==== Uses GUIscripting ====
    on selectMenu(theApp, mt, mi)
    tell application theApp
    activate
    tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
    tell menu bar item mt to tell menu 1 to click menu item mi
    end tell -- application theApp
    end selectMenu
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) 2 septembre 2010 15:53:49

  • Cell content never change in "calendar" in Numbers

    I am tracking intraday profit in Numbers, I am using the template “calendar”. Problem is cell content stays the same in each month. What formula to use?

    When you change the pop-up you are only changing the month the table shows.  If does NOT store what you enter in a special place for each month.
    I think you would find it easier to simply enter the daily information into a list which is summarized in a single table like this:
    Make two tables:
    1) called "Information" as shown on the left, above
    2) called "Summary" as shown on the right, above
    For the table on the left, titled "Information":
    make the first two rows a header using the Table formatter:
    And set up as show in the first image I posted.
    Now expand the size of the table by selecting column A (click the letter "A" at the very top of the table) and add addiitional rows by holding the command and option keys which pressing the down arrow until there are at least 365 rows.
    A3=DATE($B$1,1,1)+DURATION(0,1)×ROW()−3
    this is shorthand for... select cell A3, then type, or copy and paste from here, the formula:
    =DATE($B$1,1,1)+DURATION(0,1)×ROW()−3
    type the enter key.  Now select cell A3, again, copy
    now select  column A by click the letter "A" at the very top of the column.  now hold the command key and click cell A1, and A2 to unselect them.
    paste
    you will enter the daily amounts in column B.
    Now let's create the summary table.  Add a new table and size as show on the right in the first image of this post.  Make the first row a header.
    in cell A2 type "January" without the double quote
    now fill this down to enter the months by hovering the cursor over the bottom edge of the cell and dragging the yelow circle down
    B2=SUMIFS(Information::B,Information::A,">="&DATE(Information::$B$1, ROW()−1, 1), Information::A, "<="&EOMONTH(DATE(Information::$B$1, ROW()−1, 1),0))
    this, again, is shorthand for select cell B2, then type (or copy and paste from here) the formula:
    =SUMIFS(Information::B,Information::A,">="&DATE(Information::$B$1, ROW()−1, 1), Information::A, "<="&EOMONTH(DATE(Information::$B$1, ROW()−1, 1),0))
    now select cell B2, then copy
    select column B, then unselect cell B1 (by command  + click), then paste

Maybe you are looking for

  • Mails are not visible in UWL Inbox

    Dear All,      I am facing a problem related to UWL. we have upgraded the patch level of EP 7.0 from SP10 to SP15. Now problem is occuring in ESS Inbox (UWL) as Our 'inbox' in the portal is basically a replication of the workflow inbox  in R/3. i am

  • IPad connection to HD boxes via sky plus

    Hi My iPad will only recognise one HD box despite the fact I have 2. Initially it recognised both, but now can't find one box. Both active. Have tried uninstalling sky + app and reinstalling but no difference. Any ideas? Thanks

  • I am no good at this

    Hello everyone out there on the internets. I am in my third week of a Java class. I am trying to show at least a small amount of progress to my instructor, so if anyone could tell me where my stupid mistakes are in this code it would be greatly appre

  • PC can't see iPad

    trying to copy files to iPad from PC. Get error message "this device has eaither stopped responding or is disconnected." The PC recognizes the iPad on the network and i'm hard wired using the provided USB cable. Does anyone have a solution?

  • Unable to see or import jpegs from photo cd

    I am trying to import jpegs from a photo cd prepared by a photo store when having my film processed. The cd is recognised and I can see the folders and the actual jpeg files but cannot view photos or import into iphoto. Is there any way I can access