Table Selection

Get help using and writing Nisus Writer Pro macros.
Post Reply
User avatar
phspaelti
Posts: 916
Joined: 2007-02-07 00:58:12
Location: Japan

Table Selection

Post by phspaelti » 2009-03-20 07:40:29

The macro reference says the following:
TableSelection.new tableObject, [rowRangeObject], [columnRangeObject] v1.1
Returns a new selection describing a cell region within the given table. Both Range objects must be in-bounds for the table or an error will be displayed. If either range is not provided then the selection will encompass all rows/columns.[emphasis mine]
When I try something like this

Code: Select all

$myTableSel = TableSelection.new $myTable, $rowRange
it works as expected and I get full rows selected. But any attempt to not provide the row range fails. For example the following just returns an error:

Code: Select all

$myTableSel = TableSelection.new $myTable, , $columnRange
So my question is: is it possible to provide only a column range with some syntax I don't know about? Or is the manual in error? Or is this a bug?
philip

User avatar
martin
Official Nisus Person
Posts: 4289
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Table Selection

Post by martin » 2009-03-20 13:03:49

The core issue is that the macro language's support for missing arguments is limited. One can only omit arguments from the tail of the of list, not in the middle as you've attempted.

As to the wording in the macro language, it merely refers to the first two of the following valid usages:

Code: Select all

$myTableSel = TableSelection.new $myTable
$myTableSel = TableSelection.new $myTable, $rowRange
$myTableSel = TableSelection.new $myTable, $rowRange, $colRange
It would be more clear but less succinct to say, "if the row range, or both the row and column range, is not provided then..." Do you think the verbosity is needed to make the behavior clear?

Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Table Selection

Post by Kino » 2009-03-21 03:32:16

martin wrote:One can only omit arguments from the tail of the of list, not in the middle as you've attempted.
In that case, I think something like this would be clearer (to me at least: I seldom read the description ;-)

Code: Select all

TableSelection.new tableObject[, rowRangeObject[, columnRangeObject]]

User avatar
phspaelti
Posts: 916
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Table Selection

Post by phspaelti » 2009-03-25 07:54:40

Thanks Martin, Kino, for the comments. I deduced that this was the behavior, but now I have peace of mind as well!

As far as the description goes, since it is a technical reference I think precision trumps verbosity, but if you're worried about verbosity you could drop the either making it:
If ranges are not provided then…
philip

Post Reply