Mobile menu

Convert all tables to text
Thread poster: Bilore

Bilore  Identity Verified
France
Local time: 20:34
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


Direct link Reply with quote
 

gianfranco  Identity Verified
Brazil
Local time: 17:34
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]

    Direct link Reply with quote
     

  • Gulser Ozcan  Identity Verified
    Turkey
    Local time: 22:34
    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 works


    Direct link Reply with quote
     

    gianfranco  Identity Verified
    Brazil
    Local time: 17:34
    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


    Direct link Reply with quote
     

    Bilore  Identity Verified
    France
    Local time: 20:34
    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


    Direct link Reply with quote
     

    Jabberwock  Identity Verified
    Poland
    Local time: 20:34
    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]


    Direct link Reply with quote
     

    Bilore  Identity Verified
    France
    Local time: 20:34
    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 macro.

    Christine


    Direct link Reply with quote
     

    Vito Smolej
    Germany
    Local time: 20:34
    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


    Direct link Reply with quote
     


    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






    LSP.expert
    You’re a freelance translator? LSP.expert helps you manage your daily translation jobs. It’s easy, fast and secure.

    How about you start tracking translation jobs and sending invoices in minutes? You can also manage your clients and generate reports about your business activities. So you always keep a clear view on your planning, AND you get a free 30 day trial period!

    More info »
    TM-Town
    Manage your TMs and Terms ... and boost your translation business

    Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

    More info »



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