Page 1 of 1
[Solved] Find & Replace in multiple documents & master docs
Posted: Wed Apr 23, 2008 2:52 pm
by greyham
I'm working on a 400 page document arranged as a master document with about 30 sub-documents; one for each chapter. I want to do about 30 global find and replaces over all chapters. Opening the master document and using Find and Replace doesn't actually replace anything, because you can't edit subdocuments directly in the master document. Is there any simple or automated way to do this, without having to open every chapter and perform each find and replace seperately? 30 x 30 = ~900 find and replaces, which is going to take quite a while.
Thanks,
Graham
Re: Find and Replace in multiple documents & master documents
Posted: Thu Apr 24, 2008 5:51 pm
by Safway
After reading
http://www.oooforum.org/forum/viewtopic.phtml?t=14928 I don't think you can within the OOo graphical interface the way you are thinking. Another way of doing it would be to open all your sub-documents at once as editable documents. Begin searching for the global text in one sub-document and keep the Find & Replace window open when you go to the next sub-document and do the same with the next sub-document and the next sub-document. The trick is to realize that the Find & Replace window remembers the search/replace texts between sub-documents edits (at least with OOo version 2.4).
Are you opposed to using another tool to do so? If not, what Operating System are you using? The sed program is one of the many tools in the UNIX family that will solve what you need.
Re: Find and Replace in multiple documents & master documents
Posted: Fri Apr 25, 2008 9:21 pm
by foxcole
greyham wrote:Opening the master document and using Find and Replace doesn't actually replace anything, because you can't edit subdocuments directly in the master document.
Actually, you can edit that content by unprotecting the sections. However, even if you do that, you're only editing a copy of each subdocument as it stood when you opened the master, which follows the "links" you placed in the master's Navigator. Those aren't in fact links, they're just pointers to show the master where to find the file to be copied in.
If you don't want to use an external batch tool, one alternative might be to record a macro while you perform all thirty changes in a document, then assign the macro to a toolbar button or key combination. Make sure you don't store the macro locally in the document but in your macro library. If you need more specific instructions on how to do that, please ask. This won't be quite as easy as a batch job because you'll still need to open twenty-nine other documents and run the macro, but it is better than doing the changes one at a time, I think you'll agree.
[SOLVED]Re: Find and Replace in multiple documents & master
Posted: Sat Apr 26, 2008 7:13 am
by greyham
foxcole wrote:record a macro while you perform all thirty changes in a document, then assign the macro to a toolbar button or key combination. Make sure you don't store the macro locally in the document but in your macro library.
Excellent suggestion; thank you for this tip. What I have ended up doing is recording a macro to make a single change, and then editing the macro code manually to call the Find/Replace function multiple times with the different Search and Replace strings. The toolbar tip makes big difference too; it's easy to open 30 documents in one hit and then push my new toolbar button once for each. I am new to this level of stuff, so I was happy to find that it was doable once I had your tip.
Thanks!
Graham