Convert all tables to text
Thread poster: Bilore

Bilore  Identity Verified
France
Local time: 07:32
English to French
+ ...
Apr 28, 2006

Hello,

I'm wondering if there's a way to convert all the tables in a document to text.

The thing is I have two Word documents (source and target) and I need to align them. As there are images and tables, I stated to remove the images and to convert the tables so the alignement is easier afterwards. There are quite a lot of tables so if someone knew a way (macro?) to convert all of them at once, I'd be grateful!

Christine


 

gianfranco  Identity Verified
Brazil
Local time: 04:32
Member (2001)
English to Italian
+ ...
A simple macro Apr 28, 2006

To use the following macro:


Inset the macro in your Word environment (not expanding on this operation here)
Assign it to a button or a keyboard combination
Go to the top of the Word document
Click once for each table, each click will search for the next table and convert it
The cells will be separated by a new line
At the end, if you click once more and there are no more tables, you may get an error. Ignore it. It is the instruction to convert a new table that fails because the search has not found it. Harmless.


This is a rough macro, not very sophisticated and without some controls and error handling, but it does the simple job requested.






Sub Your_Macro()

'
' Macro to convert a Table to Text
'
'

Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext, Count:=1, Name:=""


Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With

Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, NestedTables:=True

Selection.MoveDown Unit:=wdLine, Count:=1

End Sub





bye
Gianfranco

[Modificato alle 2006-04-28 08:40]


 

H&G Ozcan  Identity Verified
Turkey
Local time: 09:32
Member (2006)
English to Turkish
Use from word Tools->Convert->Table to Text Apr 28, 2006

First select all the tables and then use
`Tools->Convert->Table to Text` from the menu.

Another way is to select all the document using `Edit->Select All` and copy then open the notepad and paste to the notepad.

I hope it worksicon_smile.gif


 

gianfranco  Identity Verified
Brazil
Local time: 04:32
Member (2001)
English to Italian
+ ...
How the macro works Apr 28, 2006

h_ozcan wrote:

First select all the tables and then use
`Tools->Convert->Table to Text` from the menu.


The tables cannot be selected all together, but only one by one.
The problem here is that apparently there are many tables and , I suppose, they are separated by normal text.


What the macro abpve does is to automate 3 simple operations
1. search for the next table
2. select the whole table
3. convert that table to text

and every click on the button associated to the macro, or very time the keyboard shortcut is pressed, the next table is searched again

Basicallly 3 operations in 1 click, and they can be executed very quickly and with minimum alteration of the original format.
That's all.



Another way is to select all the document using `Edit->Select All` and copy then open the notepad and paste to the notepad.


This method would work, but it would also remove all formatting and possibly lose some information with it.
The files could be aligned better if the attributes are maintained. For example, if the alignment tool used is WinAlign, the attributes (font, style, etc..) are used to attempt a match between the two files.



bye
Gianfranco


 

Bilore  Identity Verified
France
Local time: 07:32
English to French
+ ...
TOPIC STARTER
Thank you! Apr 28, 2006

Hello Gianfranco

I'm going to try and use your macro later on today. This is just what I needed and I hope it will works.

Once again, thank you very much.

Christine


 

Jaroslaw Michalak  Identity Verified
Poland
Local time: 07:32
Member (2004)
English to Polish
Simpler macro Apr 28, 2006

The macro might be much simpler (and effective):


Sub AllTablestoText()
'
' AllTablestoText Macro
' Macro created by Jarosław Michalak
'
For Each aTable In ActiveDocument.Tables

aTable.ConvertToText wdSeparateByCommas, True

Next aTable

End Sub



You do not have to select the tables at all - the macro itself just converts all the tables in the loop.

If you need another separator, you might replace the "wdSeparateByCommas" parameter with:

wdSeparateByDefaultListSeparator
wdSeparateByParagraphs
wdSeparateByTabs

or even put a custom separator:

aTable.ConvertToText "*", True

Hope this helps.

[Edited at 2006-04-28 08:50]


 

Bilore  Identity Verified
France
Local time: 07:32
English to French
+ ...
TOPIC STARTER
It worked! Apr 28, 2006

Thank you Jabberwok!

Your macro worked perfectly and it was very simple indeed!

It will save me a lot pof precious time and, hey, this was my first macroicon_wink.gif.

Christine


 

Vito Smolej
Germany
Local time: 07:32
Member (2004)
English to Slovenian
+ ...
this was my first macro... Apr 28, 2006

it makes a h*l of a difference if it is a short one;)

smo


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Convert all tables to text

Advanced search






memoQ translator pro
Kilgray's memoQ is the world's fastest developing integrated localization & translation environment rendering you more productive and efficient.

With our advanced file filters, unlimited language and advanced file support, memoQ translator pro has been designed for translators and reviewers who work on their own, with other translators or in team-based translation projects.

More info »
SDL MultiTerm 2019
Guarantee a unified, consistent and high-quality translation with terminology software by the industry leaders.

SDL MultiTerm 2019 allows translators to create one central location to store and manage multilingual terminology, and with SDL MultiTerm Extract 2019 you can automatically create term lists from your existing documentation to save time.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search