Mobile menu

strange behaviour of Word tables in Trados
Thread poster: Antoní­n Otáhal

Antoní­n Otáhal
Local time: 18:40
Member (2005)
English to Czech
+ ...
Mar 6, 2005

When translating tables in MS word using Trados (Word 2002, Trados 6.5 FL), sometimes the original is not chaned into "hidden" text and the font in such cells behaves in a strange way. Since I spent some time on the problem and have found a partial solution which works for me, I am putting here a MS Word macro (VBA) which can be used to preprocess the tables so that the "bad" styles (which, as far as I can tell, are responsible for the behaviour) can be removed from the tables while preserving (more or less) all other fatures of the text.

Any commments or advice on how to improve the solution will be most welcome.

*** begin macro ***

Sub preprocess_tables_for_trados()
'It will go through the selection and, in each table within this selection, it will remove styles
'which prevent Trados from proper processing of the tables
'while preserving - in each cell separately - the font name, size and colour; bold, italic and underline;
'and alignment of the cell (left, right, centered or justified)
'I have not tested it on tables in which different fonts, colours, sizes etc. are mixed in one cell
'- it would be complicated and I do not have to cope with such wild tables too often, if ever

'remember the selection as a range
Set rnng = Selection.Range
'how many tables are there in the selection?
tbn = rnng.Tables.Count
'Cycle through tables
For m = 1 To tbn
'Count columns and rows in the m-th table:
cj = rnng.Tables(m).Columns.Count
cr = rnng.Tables(m).Rows.Count
'Cycle through the cells in the m-th table:
For j = 1 To cj
For k = 1 To cr
'Even if some cells are merged, and therefore some other cells are missing,
'we do not want to stop on the missing cells:
On Error Resume Next
'so if the "rnng.Tables(m).Cell(k, j)" cell does not exist, we "resume" and go on anyway:
rng = rnng.Tables(m).Cell(k, j)
'but, if it is the case, we have to skip the action and go to the "emptyrun" label:
If Err.Number = 5941 Then GoTo emptyrun
'read properties of cells formatting:
txxt = rng.Font.Name
szze = rng.Font.Size
clit = rng.Italic
clbd = rng.Bold
clul = rng.Underline
algt = rng.ParagraphFormat.Alignment
clru = rng.Font.Color
'select the cell:
'clear format of the cell:
'put back into the cell its orginal formatting properties:
rng.Font.Name = txxt
rng.Font.Size = szze
rng.Italic = clit
rng.Bold = clbd
rng.Underline = clul
rng.ParagraphFormat.Alignment = algt
rng.Font.Color = clru
'here is the label to which the "mising cell" error jumps:
'counting indices in cycles:
Next k
Next j
Next m

End Sub

*** end macro ***

[Edited at 2005-03-06 08:29]

Direct link Reply with quote
Thank you May 6, 2005

Thank you I will certainly try

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 »

strange behaviour of Word tables in Trados

Advanced search

Translation news related to SDL Trados

Across v6.3
Translation Toolkit and Sales Potential under One Roof

Apart from features that enable you to translate more efficiently, the new Across Translator Edition v6.3 comprises your crossMarket membership. The new online network for Across users assists you in exploring new sales potential and generating revenue.

More info »
SDL Trados Studio 2017 Freelance
The leading translation software used by over 250,000 translators.

SDL Trados Studio 2017 helps translators increase translation productivity whilst ensuring quality. Combining translation memory, terminology management and machine translation in one simple and easy-to-use environment.

More info »

All of
  • All of
  • Term search
  • Jobs