LibreOffice to LyX (new thread)

Dr Eberhard Lisse nospam at lisse.NA
Wed Oct 6 12:12:12 UTC 2021


 From my early days in private practice I have about 185 surgery reports
which I wrote then in Open Office.

They are in table form and when I am really bored I copy and paste them
over into LyX files, review them and if it is correct I remove the
original (ODT).

In true Perl fashion I was wondering whether I could not avoid the
manual repetitions :-)-O

So I googled a little (Virgil are you reading this :-)-O?) and found
that the new Alpha version of the Writer2LaTeX LO module has a Java file
which you can run from the command line.

Pulled it, installed it and played with it.

It produces very reasonable LaTeX code, which is almost useful by itself
requiring a few small Perl string manipulations, but when tex2lyx'ing
it, the tables get translated into ERT and it does not even compile.

So, a

	 grep : theatre.odt.raw.tex|grep -v ^%|sort -bu|awk -F: '{print $1}'

reveals

[...]
	 Date of Birth
[...]
	 First Name
[...]
	 Name
[...]

Next time I am bored I'll hack me a Perl script that pulls what is on
the right of those (if necessary multiline) into variables and then I'll
make it fill in a template.

This similar to what I do now already for my current reports (in LyX)
which contain strings like this:

	 Name: $$SURNAME$$ First Name: $$FIRSTNAME$$ Date of Birth: $$BIRTHDATE$$

so after slurping the whole file into a variable $LyXfile something like

	 $LyXfile =~ s/\$\$FIRSTNAME\$\$/$FIRSTNAME/g;
	 $LyXfile =~ s/\$\$SURNAME\$\$/$SURNAME/g;
	 $LyXfile =~ s/\$\$BIRTHDATE\$\$/$BIRTHDATE/g;

will do the trick :-)-O

greetings, el
-- 
To email me replace 'nospam' with 'el'



More information about the lyx-users mailing list