is it possible to easily convert tables to text?

Everything related to our flagship word processor.
jdd
Posts: 11
Joined: 2006-09-13 17:42:08
Location: Japan

is it possible to easily convert tables to text?

Post by jdd » 2008-04-03 16:51:33

Hello,

I've read with interest about the time lag problems with leopard--I'm using an older G4 at 1ghz, NWP (1.0.3), and 10.5.2 now. I'm dealing with an 88-page document that uses a large number of tables with very little other text (1-4 tables per page). Without NWP already running, it takes almost four minutes to open the app itself and this document.

It's a multi-lesson textbook, and I think the author used tables to more conveniently import text that he'd been organizing in Excel (instructional dialogs, exercises, and vocabulary lists). He may also have seen tables as a way to provide formating.

But for my purposes (the book as it now stands) I don't need the tables, and I think that as a table-less text file it would load faster, and it would also be easier to deal with in other ways*. I'd be willing to work thru this document to delete them if it's not too hard. Many of the tables share the same formating so I think that could be preserved/redone with barely a handful of rulers--IF that's that way to go. I've browsed the manual and of course do see how to delete an entire table, but I would like to preserve the text contained in each one. Suggestions? Or can I somehow copy the text without the tables and paste that into a new document? (I've tried this and still get tables, whether I choose Use Existing Styles or not.)

*Even just some simple experimenting with edits to this document sends me into the twilight zone of the spinning pizza wheel...!

tia,

John D.

ProfT
Posts: 80
Joined: 2005-03-09 06:53:40
Location: La Mirada, CA

Post by ProfT » 2008-04-03 17:13:01

I believe that you can do what you'd like to accomplish by using the Copy Table Text command under the Table menu. When you paste after this copy you will get just the text.

Prof T

jdd
Posts: 11
Joined: 2006-09-13 17:42:08
Location: Japan

Post by jdd » 2008-04-03 17:32:33

Yes, great, and thanks much. :) I'd missed that command.

(too bad, tho that I'll have to do it table by table)

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

Post by martin » 2008-04-03 22:42:14

If you want to convert all tables in a document to text, you can use this macro:

Code: Select all

#move to start of document
Set Selection 1, 0

# convert all tables
While Select Next Table
	Copy Table Text
	Delete
	Paste
End

jdd
Posts: 11
Joined: 2006-09-13 17:42:08
Location: Japan

Post by jdd » 2008-04-03 23:09:32

Martin,

Thanks a lot for that macro, tho I'll have to approach that carefully--I'm even less 'fluent' in macros than I am in tables.

Still, this would be a great and very practical place to start. I think I'll pass a link to this thread on to the author of the textbook, who apparently has a background in databases, and try to work together on it.

many thanks again,

John D.

PS--there's a macbook pro on the (distant) horizon, so maybe the speed thing will kind of solve itself.

ProfT
Posts: 80
Joined: 2005-03-09 06:53:40
Location: La Mirada, CA

Post by ProfT » 2008-04-04 04:34:13

The Copy Table Text command will work across multiple tables. I even tried it on multiple tables separated by chunks of text. I used the non-contiguous selection feature (which I love in NWP) and then when all of the tables were highlighted, the Copy Table Text command worked exactly as it had on a single table.

This might be an alternative if the macro approach seems a bit daunting.

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

Post by martin » 2008-04-04 11:40:02

jdd wrote:PS--there's a macbook pro on the (distant) horizon, so maybe the speed thing will kind of solve itself.
Certainly shiny new toys will help :) We're also working on an update to NWP that will help increase its speed on Leopard.

jdd
Posts: 11
Joined: 2006-09-13 17:42:08
Location: Japan

Post by jdd » 2008-04-05 05:26:29

ProfT and Martin--thanks again, I'll try simply selecting more than a single table tomorrow. (something to do while I look out the window at cherry blossoms!)

jdd
Posts: 11
Joined: 2006-09-13 17:42:08
Location: Japan

follow-up

Post by jdd » 2008-04-05 16:23:48

Martin (and ProfT)

The macro that Martin provided seems to have worked. It took several minutes--it seemed to go thru the file in steps--and tho I haven't looked thru the end result to see if anything unplanned happened along the way, it generally looks like I expected it to.

And the opening speed is hugely different. The revised, table-less file opens in a little over 10 seconds (NWP 1.0.3; OS 10.5.2, on a 1ghz powerbook with only 768mb of RAM). And it may be a little faster on a second powerbook I use, 1.5gb of ram and a 1.67ghz cpu.

Now to set up a few rulers! Page-to-page formating is very consistent, I think I might be able to get away with five.

Thanks again, folks!

John D.

writerhoward
Posts: 48
Joined: 2013-02-03 05:10:26

Re:

Post by writerhoward » 2013-02-16 08:18:48

martin wrote:If you want to convert all tables in a document to text, you can use this macro:

Code: Select all

#move to start of document
Set Selection 1, 0

# convert all tables
While Select Next Table
	Copy Table Text
	Delete
	Paste
End
What if I only want to convert the table in which I've either selected some text (or clicked in) to text and then have the table removed, as Pages' "Convert Table to Text" does? How would the above macro need to be changed?

Howard

P.S. I've asked my question here rather than in the macro forum as this forum was where the original post was.

rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: is it possible to easily convert tables to text?

Post by rmark » 2013-02-19 15:53:48

Howard,
What if I only want to convert the table in which I've either selected some text (or clicked in) to text and then have the table removed, as Pages' "Convert Table to Text" does? How would the above macro need to be changed?
In that case all you need do is choose the menu command Table > Copy Table Text, delete the table and then paste in the contents of the Clipboard.
Write On!
Mark Hurvitz
Nisus Software Inc.

writerhoward
Posts: 48
Joined: 2013-02-03 05:10:26

Re: is it possible to easily convert tables to text?

Post by writerhoward » 2013-02-19 18:00:34

rmark wrote:Howard,
What if I only want to convert the table in which I've either selected some text (or clicked in) to text and then have the table removed, as Pages' "Convert Table to Text" does? How would the above macro need to be changed?
In that case all you need do is choose the menu command Table > Copy Table Text, delete the table and then paste in the contents of the Clipboard.
I've tried that; however, when I click in a table, execute Table > Copy Table Text, and then click Paste outside the table, nothing gets pasted.

This is the table whose contents I tried to copy shown after I've clicked in it:
Screen shot 2013-02-19 at 8.55.11 PM.png
Screen shot 2013-02-19 at 8.55.11 PM.png (9.24 KiB) Viewed 7853 times

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

Re: is it possible to easily convert tables to text?

Post by phspaelti » 2013-02-19 18:43:03

You have to *select* the table (not just click inside it) for Copy Table Text to have any effect :)
philip

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

Re: is it possible to easily convert tables to text?

Post by martin » 2013-02-19 18:44:49

phspaelti wrote:You have to *select* the table (not just click inside it) for Copy Table Text to have any effect :)
That's exactly right, and that can be done using either the mouse or the menu Table > Select > Table, which expands any selection in a table to encompass the whole table.

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

Re: is it possible to easily convert tables to text?

Post by phspaelti » 2013-02-19 19:01:48

And I just noticed that Table > Select > Table works correctly across multiple tables. (I have always been using Select All (twice) to select tables, but that only works on a single table.)
philip

Post Reply