Can The Style of A Table In Numbers Be Set Programmatically - applescript

Pretty straight forward. There are different styles of tables to choose from manually. The AppleScript Numbers library doesn't mention the style can be set, and an internet search isn't turning up many results. Has anyone had success or made the ultimate decision that it can't be done? I'm hoping it can be done without using system events to "click" a table style.
set newTable to make new table with properties {style:"Something here?", column count:10, header column count:1, footer row count:1, position:{0, 72}, name:"Sample Table", header row count:1, row count:10}
#Or Here?
tell newtable
set style of table somehow?

Technically yes. You could set the properties of rows and columns in the tell newTable area. Although it's not the easy way, it can still be done if you build it from scratch. (Which you are doing)
EDIT To clarify with a little more and include examples, if you're having trouble identifying additional properties that can be set, you could use get properties of table 1 to guide you further if the library isn't much assistance. Getting properties would yield you results similar to below.
tell application "Numbers"
get properties of table 1 of sheet 1 of document 1
(* returned from get properties of table
{locked:false, cell range:range "A1:E10" of table 1 of sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", column count:5, parent:sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", header column count:1, footer row count:0, class:table, header columns frozen:true, position:{16, 43}, filtered:false, header rows frozen:true, width:490, name:"Table 1", selection range:range "A1:E10" of table 1 of sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", header row count:1, height:203, row count:10}
*)
get properties of row 1 of table 1 of sheet 1 of document 1
(* returned from get properties of row
{vertical alignment:top, font name:"Helvetica-Bold", class:row, background color:{18205, 30509, 7341}, name:"1", text wrap:true, text color:{65528, 65533, 65524}, alignment:auto align, format:automatic, address:1, font size:10.0, height:20.625}
*)
get properties of column 1 of table 1 of sheet 1 of document 1
(*returned from get properties of column
{vertical alignment:top, font name:"Helvetica-Bold", class:column, background color:{27817, 27821, 27814}, width:98.0, format:automatic, text wrap:true, text color:{65528, 65533, 65524}, alignment:auto align, name:"A", address:1, font size:10.0}
*)
end tell
Using the above, you're able to see specific characteristics able to be set. Then you could mimic those settings in your own table as demonstrated below with a slight mix of variations of using the tell newTable block
tell application "Numbers"
activate
set thisDocument to make new document
tell sheet 1 of thisDocument
delete every table
set newTable to make new table with properties ¬
{name:"Sample Table", position:{16, 43}, column count:5, row count:10, header column count:1, header row count:1, footer row count:1}
tell newTable
set properties of column 1 to {width:216, background color:{27817, 27821, 27814}}
set format of column 2 to checkbox
set properties of column 3 to {width:98, format:currency}
set properties of row 1 to {background color:{18205, 30509, 7341}}
set properties of last row to {background color:{18205, 30509, 7341}}
set value of last cell to "=SUM(E)"
end tell
end tell
end tell
If you're looking for very specific borders, you could start the document off with using a template that uses the desired border you want, since every table started in that template will be the same default table. However since you're scripting it to begin with, and didn't specifically mention looking on how to change the border, I'm under the impression you're after colors, formats, and formulas rather than borders. So the answer to the question still remains "technically yes" you can programmatically set the style of your table.

Related

BIRT Report Designer - Table to Produce Rows in Multi Columns

I have a table, which is listing the name of benefits and it is only 1 column (just name of the benefit).
I'm wondering if there is any native function of BIRT Report Designer to produce rows not only vertically but also populate horizontally to 3-4 columns.
Something like below:
Benefits List
Benefit-1 Benefit-3 Benefit-5
Benefit-2 Benefit-4 Benefit-6
Thanks in advance for any advice.
Ok, I found a solution!
Under the following link there is a Eclipse Community Page Link recommendation about an additional computed column. Even though I don't have any computed column, the recommendation gave me an inspiration. Instead of creating an additional column, I used the rownum that is used generally to bind dataset parameter. For the table row, I created "visibility" condition that checks if the rownum + 1 is divided by 3. Depending on what is the result, it will be hidden or viewed:
Main Grid
It includes a grid with 2 rows and 3 columns. 1 row is merged to view the header. In each column of second row, the same table is placed with the same dataset.
Image Showing Main Structure
Select Table Row
Image Indicating Row Selection
Set the Visibility
Image Showing Details of Visibility Condition
The syntax basically means: "Do not show the row if the division result is not 1".
For the second column, you will need to compare with 2: (row.__rownum + 1) % 3 != 2 and the third column with 0: (row.__rownum + 1) % 3 != 0
Hope it'll be helpful for someone.
An more straightforward approach ist to use a List item instead of a Table item.
In the detail area of the List, create a Grid item of fixed width and height.
Put the content (e.g.) text into the grid's cells.
Important: Set the "display" property of the grid to "inline" instead of the default "block".
This way BIRT will put the grids from left to right until the line is full.
Then it will fill the next line (think of "display: inline" like adding words to a paragraph).

How to click on Web Table column's Web Button in following case?

I have one web table, in this I want to delete particular record by clicking on record's delete button.
I got the value of row but I am not able to perform click on web button of particular row and also there is 2 buttons in one column.
How to click on delete icon of particular row?
You need to set a reference to the item within the specific row and then click on it - something like this:
Set oLink = Browser("myBrowser").Page("myPage").WebTable("myTable").ChildItem(iRow,8,"Link",0)
oLink.Click
You will potentially need to amend the "Link" and the number 8 in your own code. iRow represents the row you are trying to interact with.
Essentially what this code does is set an object reference to the first item of type "Link", in column 8 of the table, then uses a Click event to select it. If your delete icon is a WebButton, then replace "Link" with "WebButton" for example. The final 0 in the command tells UFT to select the first element matching the object type - you might need 1 if your two icons are in the same column of the table.
Let me know if that helped.

Dynamic cell via parameter

I am trying to find how to do the following. I need to fill a string (a word) in a column that I can change from a table. Static way: Add Column > In formula ="FORD" So it fills all existing rows in the columns Variable way: If I change to HONDA the cell at the table, use  the new word in the query Thanks!
Something like https://stackoverflow.com/a/31522846/771768 will work:
Click on the Excel cell with HONDA, then open menu Power Query > Excel
Data > From Table (uncheck "My table has headers")
In the Power Query editor, right click on the HONDA cell of the table
and "drill down" to get the text value, and change your add column step to use this Column1
You can edit the value in sheet 1, and when you refresh your query
you'll see sheet 2 is changed.

BIRT Reports column not spanding the whole row as desired

I am fairly new to BIRT reports.
In the BIRT reports designer I have added a 2nd row to my table which is binded to a data set. In this 2nd row I want 1 column from my data set to take up the whole row.
So what I did was to add the second row and merge all the columns in that row to form one column. I then added a text field with Dynamic HTML Text.
<VALUE-OF>row["ITEMDESCRIPTION"]</VALUE-OF>
The problem I have is that the data is not taking the whole row. It is being wrapped into only a small section of the row. I must be missing something. Can someone help me with this pls.
I'm attaching both the way the end report looks like and also the screenshot of the set up in the designer.
End Result
Designer (you can see all the rows merged in the second row of the table and in the properties i can see a colspan of 10 for that single column)
thanks
I've found out that the asnwer to this question is to make the field element inline style rather than block and also to check the No Wrapping check box for this field int he designer.

Insert cell in table row eclipse birt

I can't seem to find a way to insert another cell in a row of my table in a Birt report in Eclipse, does anybody know how to do that?
Thank you
Not exactly sure which problem you are having but the solution should either be;
1 Insert a column in the table
Select the table
Right mouse click at top of column and insert a column to left or right
2.Insert a grid into an existing cell, without adding a column. (Usually you do this when you want to have a label and an aggregation in the same header or footer cell)
From the Palette, drag and drop a 'Grid" element into the cell,
set 'number of columns' to 2 and 'number of rows' to 1.
put you other elements (i.e. label and aggregation) into the seperate cells of the grid in the single cell of the table.

Resources