Copy all paragraphs underneath each other in MS Word
Thread poster: Alex Lago
Alex Lago
Alex Lago  Identity Verified
Spain
Local time: 20:14
English to Spanish
+ ...
Nov 10, 2014

I'm doing a job on an MS Word file, the job calls for placing the translation for each paragraph underneath the original paragraph in between brackets [] and in bold and italics leaving the original paragraph on top.

I prefer working with a CAT tool so I was wondering if anyone knows what macro I could set up in Word to do the following:

1- Copy each paragraph underneath itself in between brackets and in bold and italics.

2- Then make the original paragraph
... See more
I'm doing a job on an MS Word file, the job calls for placing the translation for each paragraph underneath the original paragraph in between brackets [] and in bold and italics leaving the original paragraph on top.

I prefer working with a CAT tool so I was wondering if anyone knows what macro I could set up in Word to do the following:

1- Copy each paragraph underneath itself in between brackets and in bold and italics.

2- Then make the original paragraph hidden so it doesn’t show up in the CAT TOOL.

Any help would be much appreciated as I've no idea how to go about this but I think it is possible.
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 20:14
Member (2006)
English to Afrikaans
+ ...
One method Nov 10, 2014

Alex Lago wrote:
I'm doing a job on an MS Word file, the job calls for placing the translation for each paragraph underneath the original paragraph in between brackets [] and in bold and italics leaving the original paragraph on top.


If your file has no tables, then... instead of a macro, how about this: Convert the entire document to a 1-column table, and then duplicate the column. Translate that column in your CAT tool. Then insert the translated column next to the source text column. Format both columns the way you want them. Then convert the table to text, with the "paragraph" option.

Any help would be much appreciated as I've no idea how to go about this but I think it is possible.


It's a bit tricky because the macro recorder can't "record" hidden and bold/italics.

Try this one (but make sure you search afterwards for accidentally doubled { and } and [ and ]).


 
Tuan Dzung
Tuan Dzung  Identity Verified
Vietnam
Local time: 01:14
Member (2014)
English to Vietnamese
+ ...
Transtools may be suitable for you Nov 11, 2014

Dear Alex,

- Download "Transtools for Word" from here:
http://www.translatortools.net/
- Use "Dual-language document assistant" to create highlight colour (yellow, for example) for source text/paragraph.
- Then use Hide/unhide text of Transtools to hide source text/paragraph.
- Import to CAT tool.



[Đã chỉnh sửa 2014-11-11 06:56 GMT]


 
esperantisto
esperantisto  Identity Verified
Local time: 21:14
Member (2006)
English to Russian
+ ...
SITE LOCALIZER
More specific Nov 11, 2014

Alex Lago wrote:

I prefer working with a CAT tool


You should be more specific on the CAT tool of your preference. In such a case, perhaps, advise could be more detailed.

If the tool supports export of a TM for a particular file, do:

  1. export a TMX file for the document;
  2. convert it to CSV using any suitable tool such as Okapi Olifant;
  3. load it to Word and convert text to table;
  4. apply bold/italic to the column with translations;
  5. convert the table to tab-delimited text;
  6. find and replace ^p with ]^p;
  7. find and replace ^t with ^p^t[;
  8. done.


If the tool supports export to two-column text, start from the step 3.


 
Alex Lago
Alex Lago  Identity Verified
Spain
Local time: 20:14
English to Spanish
+ ...
TOPIC STARTER
Thanks for the suggestions Nov 11, 2014

Thank you all for the suggestions, this is what I ended up doing:

1- Replace all paragraph with ]paragraph[, which in Word was replace "^p" with "]^p[", which gave me a brackets at the end and beginning of every paragraph.
2- Put the start bracket "[" on the first paragraph and the end one "]" on the last paragraph
3- Convert text to 1 column table
4- Copy the text to a second column
5- Remove the brackets from the text in column one by simply replacing them
... See more
Thank you all for the suggestions, this is what I ended up doing:

1- Replace all paragraph with ]paragraph[, which in Word was replace "^p" with "]^p[", which gave me a brackets at the end and beginning of every paragraph.
2- Put the start bracket "[" on the first paragraph and the end one "]" on the last paragraph
3- Convert text to 1 column table
4- Copy the text to a second column
5- Remove the brackets from the text in column one by simply replacing them with nothing ( in two steps, first removing "[" and then "]").
6- Make the text in the second column bold and italics
7- Make the text in column one hidden (so the CAT tool, Wordfast, does not see it).
8- Translate the file and prepare translated Word file.
9- Make all hidden text not hidden
10- Merge all the cells in the table into one single cell (this puts the text in column 2 under the corresponding text in column 1)
11- Copy the text in the table outside the table and delete the table.
Collapse


 
Minh Nguyen
Minh Nguyen  Identity Verified
Vietnam
Local time: 01:14
English to Vietnamese
If you have many files? Nov 12, 2014

I have come across similar situations. Based on your requirement I have created a little app which you may find useful. Please see the link below (source code included).

https://onedrive.live.com/redir?resid=219A5C543AE886DD!146



Output:
... See more
I have come across similar situations. Based on your requirement I have created a little app which you may find useful. Please see the link below (source code included).

https://onedrive.live.com/redir?resid=219A5C543AE886DD!146



Output:

Collapse


 
Alex Lago
Alex Lago  Identity Verified
Spain
Local time: 20:14
English to Spanish
+ ...
TOPIC STARTER
Thanks linhdan Nov 12, 2014

Thanks for sending the app

 
Mikhail Zavidin
Mikhail Zavidin
Local time: 21:14
English to Russian
+ ...
a macro just from the oven Nov 12, 2014

Alex you can try that:

Sub SmartDoubling()
Dim Para As Paragraph
Dim ParaIx As Long
Dim r As Range
Dim text As String
ParaIx = 0
Dim Count As Long
Count = ActiveDocument.Paragraphs.Count * 2
Do
ParaIx = ParaIx + 1

Set r = ActiveDocument.Paragraphs(ParaIx).Range
text = Mid(r.text, 1, Len(r.text) - 1)
r.Font.Hidden = True
r.text = text & vbCrLf & "[" & text & "]" & vbCrLf
ParaIx = Pa... See more
Alex you can try that:

Sub SmartDoubling()
Dim Para As Paragraph
Dim ParaIx As Long
Dim r As Range
Dim text As String
ParaIx = 0
Dim Count As Long
Count = ActiveDocument.Paragraphs.Count * 2
Do
ParaIx = ParaIx + 1

Set r = ActiveDocument.Paragraphs(ParaIx).Range
text = Mid(r.text, 1, Len(r.text) - 1)
r.Font.Hidden = True
r.text = text & vbCrLf & "[" & text & "]" & vbCrLf
ParaIx = ParaIx + 1
Loop While ParaIx < Count

ParaIx = 0

For Each Para In ActiveDocument.Paragraphs
ParaIx = ParaIx + 1
Set r = Para.Range
If ParaIx Mod 2 = 0 Then
r.Font.Italic = True
r.Font.Bold = True
r.Font.Hidden = False
End If

Next Para

End Sub

I have run it on a couple of simple word files. Hope it helps.
Collapse


 
Alex Lago
Alex Lago  Identity Verified
Spain
Local time: 20:14
English to Spanish
+ ...
TOPIC STARTER
Thanks Mikhail Nov 13, 2014

Worked perfectly, thank you.

 


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


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

Copy all paragraphs underneath each other in MS Word






Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

Buy now! »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »