Home Forums General XMetaL Discussion Set align and valign attributes in xmax. Reply To: Set align and valign attributes in xmax.


Reply to: Set align and valign attributes in xmax.

It seems this is a more challenging problem than I thought.  (I had my suspicions, which is why I hedged in the first place.)  The problem is that, internally, XMetaL treats selections inside tables a little bit differently than selections anywhere in a document.  Unfortunately this has a side effect that some of the XMetaL APIs return unexpected results when your selection is, say, a sequence of table rows or cells.  (This is true both for CALS tables such as the example by Joco73, and for HTML tables which are also supported by XMetaL.)

With non-table elements, it is possible to write scripts that iterate over a selected range of nodes, using APIs such as Range.Contains, Range.Collapse, and the Range comparison APIs.  Basically you would set a Range variable at the beginning of the user's selection, and another one at the end, and use those in the loop-testing conditions as you move another Range across and set your attributes (or whatever).

But it is precisely those Range APIs that work differently when the selection is within a table.  The only way we can think to accomplish something like this would be to provide some sort of artificial mechanism for your script to know how many nodes to process.  Imagine prompting the user “How many cells would you like me to process?” and then use the current selected cell as a starting point.  Or, for another example, provide macros that are designed to work on all the cells in a single row, column, or table.  (Use the Range.Move*** APIs to do the moving around.)