strange behaviour of Word tables in Trados
Thread poster: Antoní­n Otáhal
Antoní­n Otáhal
Antoní­n Otáhal
Local time: 01:01
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 ... See more
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:
rng.Select
'clear format of the cell:
Selection.ClearFormatting
'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:
emptyrun:
'counting indices in cycles:
Next k
Next j
Next m

End Sub

*** end macro ***


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


 
Thank you May 6, 2005

Thank you I will certainly try

 


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







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 »