I've been searching for the solution for quite a while already but i haven't found any. I'm not sure if I'm using wrong words to search or not.
Anyway, here's my little problem. I want to create a macro that will create Master Document and/or Add more sub-documents in an existing master Document file.
The reason behind this is that I have 'live' set of files that I want to include in a Master document. What I mean by 'live' is that, not only the content of the files are changing but some files are being deleted and new files are being created. And with this kind of scenario I want my Master document to get all this changes, the content updates, new files and deleted files. I know Master Document can update the changes but adding new files as sub-document is not automatic. I have to manually insert it. This is why I want to create a macro that will automatically update master document for those changes.
I've tried recording the macro for the Insert a sub-document nor create new master file but I failed. There's no record macro button in Master document. I have macro that can list all filenames within a folder and its subfolders but I'm at lost on how to insert it as sub-document in the Master. I've read somewhere in this forum that Master document has to be created manually. So creating master document using a macro might be impossible. If that's the case, I hope there's a way to build a macro that will auto-insert document in the master document.
Thanks!
Macro for creating master document or adding more sub-doc
Macro for creating master document or adding more sub-doc
Libreoffice 3.5 on Arch linux / Open office 3.4 on Windows XP
Re: Macro for creating master document or adding more sub-do
I'm not sure if my question or problem weren't clear enough or macro for creating/editing master document is not feasible. =(
I still hope that there's a solution to my problem.
I still hope that there's a solution to my problem.
Libreoffice 3.5 on Arch linux / Open office 3.4 on Windows XP
Re: Macro for creating master document or adding more sub-do
Not sure if it is really not working with a macro. But due to the well documented XML format of OpenOffice there is an alternative approach to achieve what you want. In my eyes a master document is just a pair of glasses (sun glasses, yellow glasses, whatever ...) for a certain view on a bunch of writer files. The styles in the master file define how the documents look like and are printed. So with two .odm files that include the same set of files you can print them as A4 paper format with one master and maybe as A5 format with the other master. At least if you have simple text. If you have a lot of textboxes anchored to the page this kind of flexibility due to the clean separation between content and layout will find its limits.
I would give it a go and modify the .odm file directly as a zip archive of xml files. The main xml file (content.xml) contains the following piece of code for a single sub-document.
The value of the text:style-name attribute might be different in your case, but in all of the master documents that I inspected the same style-name is used for every subdocument. The double period before Options.odt don't mean "in the parent directory" but rather "in the parent container of the zip file". In other words the Options.odt and the Master.odm files live in the same filesystem directory. Python and its zipfile module together with the XML classes of Python should be ideal to do the required manipulation in the internals of the .odm file. But when you manipulate the .odm file from outside it is not wise to have this file open in OpenOffice at the same time.
And as always when you work on this low level, make sure that you have a backup that is up to date.
I would give it a go and modify the .odm file directly as a zip archive of xml files. The main xml file (content.xml) contains the following piece of code for a single sub-document.
Code: Select all
<text:section text:style-name="Sect1" text:name="Options.odt" text:protected="true">
<text:section-source xlink:href="../Options.odt" text:filter-name="writer8"/>
</text:section>
And as always when you work on this low level, make sure that you have a backup that is up to date.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.