Swapping Rows and Columns of a Table

Everything related to our flagship word processor.
Post Reply
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Swapping Rows and Columns of a Table

Post 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
Swap Rows and Columns macro.tiff (93.82 KiB) Viewed 8717 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
philip
User avatar
greenmorpher
Posts: 767
Joined: 2007-04-12 04:01:46
Location: Melbourne, Australia
Contact:

Re: Swapping Rows and Columns of a Table

Post by greenmorpher »

Thank you Philip. Neat.

Cheers, geoff
User avatar
sebwin
Posts: 20
Joined: 2007-07-18 01:33:44

Re: Swapping Rows and Columns of a Table

Post by sebwin »

Brilliant!

Edit:
…only that Table Cell Shading attributes are dropped.
…and the padding.
nag, nag. :(
Sebastian
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Swapping Rows and Columns of a Table

Post 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?
philip
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Swapping Rows and Columns of a Table

Post 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.
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Swapping Rows and Columns of a Table

Post 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.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Swapping Rows and Columns of a Table

Post by phspaelti »

And here's an updated macro.
Swap Rows and Columns.nwm
(24.09 KiB) Downloaded 484 times
philip
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Swapping Rows and Columns of a Table

Post by martin »

Thanks Philip, you're always on top of things!
Post Reply