End-of-cell blanks in Word table
Thread poster: Daniel Frisano
Daniel Frisano
Daniel Frisano  Identity Verified
Italy
Local time: 17:54
Member (2008)
English to Italian
+ ...
Mar 3, 2022

Is there a way to use find-and-replace in Word to catch all the blank spaces that occur at the end of table cells? (Or at the beginning, since we're at it.)

In other words, is there an "end of cell" marker that can be used in find-and-replace, possibly inside regex?


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 18:54
English to Russian
Workaround Mar 3, 2022

There is no code for the end of cell marker, but you can use a trick.
1. Create a custom style in MS Word, name it Table Cell for example.
2. Mark all your tables with that style.
3. Invoke the find and replace feature with Ctrl+H.
4. Leave the 'Find what' field blank but select the Table Cell style for it.
5. In the 'Replace with' field type ^&@@@ and replace all.
6. Replace [ @@@] (less brackets) with blank field. That will remove all the instances of [spa
... See more
There is no code for the end of cell marker, but you can use a trick.
1. Create a custom style in MS Word, name it Table Cell for example.
2. Mark all your tables with that style.
3. Invoke the find and replace feature with Ctrl+H.
4. Leave the 'Find what' field blank but select the Table Cell style for it.
5. In the 'Replace with' field type ^&@@@ and replace all.
6. Replace [ @@@] (less brackets) with blank field. That will remove all the instances of [space+@@@].
7. Replace @@@ with blank field for the other instances that appear where there was no space initially.
Done

[Edited at 2022-03-03 17:11 GMT]
Collapse


 
Daniel Frisano
Daniel Frisano  Identity Verified
Italy
Local time: 17:54
Member (2008)
English to Italian
+ ...
TOPIC STARTER
Freakin' brilliant Mar 3, 2022

Thanks Stepan, worked like a charm.

Since my document is all a big table, I didn't even need to create the custom style.

All I needed was a property that is common to the whole text for the "Find what" field, in my case Font color = Automatic. Or you can use an obscure never-used property as a dummy, like Format > Font > Not Emboss or something.


Stepan Konev
 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 18:54
English to Russian
Workaround 2 Mar 3, 2022

Alternatively you can select all text in your table, then press Ctrl+E, Ctrl+L. This will remove both leading and trailing spaces. However, this workaround may require manual work if you have different paragraph alignment styles.

Elena Feriani
 
Rolf Keller
Rolf Keller
Germany
Local time: 17:54
English to German
Word is XML Mar 4, 2022

FWIW:
In Word's document.xml file you can locate & change the text content of table cells.
Rename .docx to .zip, then open the .zip file and dig out the document.xml file.

In that file use a regular expression for search and replace. The following is the text you'll find within Word's xml file:
{w:tc} ignore some stuff here {w:t} this is the cell's text content {/w:t}

Note: In the above string I used curly brackets, just because ProZ's editor do
... See more
FWIW:
In Word's document.xml file you can locate & change the text content of table cells.
Rename .docx to .zip, then open the .zip file and dig out the document.xml file.

In that file use a regular expression for search and replace. The following is the text you'll find within Word's xml file:
{w:tc} ignore some stuff here {w:t} this is the cell's text content {/w:t}

Note: In the above string I used curly brackets, just because ProZ's editor doesn't like angle brackets.

Looks difficult but might be the only way (besides a macro, of course) to achieve certain automatic changes.
Collapse


Stepan Konev
 
Daniel Frisano
Daniel Frisano  Identity Verified
Italy
Local time: 17:54
Member (2008)
English to Italian
+ ...
TOPIC STARTER
@RK Mar 4, 2022

Right, some operations are better done low-level.

Now I'm left wondering if there are editors that allow you to manipulate a Word document LaTeX-style. (Anyone remember TeX and LaTeX?)


 


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


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

End-of-cell blanks in Word table






Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »
Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »