Page 1 of 1
Swapping Rows and Columns of a Table
Posted: 2013-11-02 07:11:48
by phspaelti
I don't usually cross-post, but I thought there might be people who don't usually look in the macro forum, but might nevertheless be interested in such a thing.
Below is a macro that will flip a table's rows and columns. It works for tables with different numbers of rows and columns, and it also works with tables that have merged cells. it also copies cell edge attributes, and it tries to preserve the size of the table and the relative widths and heights of the rows and columns, as far as possible.
Here is a sample output:

- Swap Rows and Columns macro.tiff (93.82 KiB) Viewed 9642 times
If this is of interest, the macro can be downloaded from this thread:
http://www.nisus.com/forum/viewtopic.php?f=17&t=5512
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-04 09:55:12
by greenmorpher
Thank you Philip. Neat.
Cheers, geoff
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-04 11:27:01
by sebwin
Brilliant!
Edit:
…only that Table Cell Shading attributes are dropped.
…and the padding.
nag, nag.

Re: Swapping Rows and Columns of a Table
Posted: 2013-11-04 22:23:22
by phspaelti
sebwin wrote:Edit:
…only that Table Cell Shading attributes are dropped.
…and the padding.
nag, nag.

Well, tell that to Nisus-soft. Yes, why can't we have macro control of cell shading?
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-06 18:11:23
by martin
Philip, thanks for providing this excellent macro (and others)!
phspaelti wrote:sebwin wrote:Edit:
…only that Table Cell Shading attributes are dropped.
…and the padding.
nag, nag.

Well, tell that to Nisus-soft. Yes, why can't we have macro control of cell shading?
Consider us told! It's actually not that we didn't think of it, or want to add it, but there just wasn't enough time to sneak it into Pro 2.0.6. Don't worry, it's still on the list.
PS: Sebastian, I love your forum avatar.
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-26 23:38:07
by martin
There's no support for table cell padding in the macro language yet, but the just released
Nisus Writer Pro 2.0.7 did add support for cell shading. There's also support in 2.0.7 for inspecting and controlling paragraph shading attributes.
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-26 23:48:29
by phspaelti
And here's an updated macro.
Re: Swapping Rows and Columns of a Table
Posted: 2013-11-27 14:04:16
by martin
Thanks Philip, you're always on top of things!