You may want to convert a PDF file to EPS format, for example to insert it in a Microsoft Word of LibreOffice Writer document.
One way to do is like this. This workflow creates an intermediary Postscript file during the conversion. Note: no need to provide name of the output EPS file, it will be created automatically.
pdf2ps myfile.pdf myfile.ps; ps2eps myfile.ps
To find paragraph breaks (i.e. the ASCII line feed character 0A hex) in LibreOffice, use the currency symbol “$” as the search string.
Make sure to look into “Other options” and check “Regular expressions” in the “Find & Replace” dialog.
By the way, searching for “\n” and replacing it with “\n” can be done only once, as on the repeated action there will be no matches found anymore and searching for “$” must be done instead. Read some more about this bug/feature/inconsistency here.
You may want to use some external variables that are shared between several of your Writer documents.
One way to do that would be to use Mail Merge, but that may not be what you prefer.
Another solution is to insert the data you want as DDE link to the source document.
Let’s say you have a string in your Calc spreadsheet and you want it to show up in your Writer document:
- Open the Calc spreadsheet
- Copy the cell
- Open the Writer document
- Select menu Edit -> Paste Special -> DDE Link
- Press Ctrl+Z
- Press Ctrl+F
- Select Variable tab
- Select Type: DDE Field
- Select the name of variable in Select control
- Click Insert button
The method is a bit clumsy, but it works just fine. Possibly you may stop after pasting the DDE link, which gives you a fragment of a table, depends upon what do you need.
To see field values instead of field codes:
- Select menu View -> Field Names (or press Ctrl+F9)
Just like when converting ODT to PDF, you can use LibreOffice (OpenOffice.org) in command line mode for high quality conversion of all of the ODT files in a directory to MS Word DOC files:
libreoffice --headless --convert-to doc ./*.odt
- Before you run this command, make sure that LibreOffice (OpenOffice.org) is not running in background. Otherwise it will fail.
- Use ./*.odt instead of simply *.odt, because otherwise the program will consider file names beginning with “-” to be an argument and will fail.
This is a python script created with a single purpose: to test unzipping of OpenOffice.org (LibreOffice) word processor .odt document file, searching in its contents for a certain text and replacing it with a substitute, and, eventually, zipping it all back together to form a new .odt document.
If you copy and past this text, remember, that HTML formatting may spoil the code, so please check it for any introduced mistakes. Especially since this is python with its indentation issues.
#!/usr/bin/python # # Just a test script # Demonstrates unzipping, editing and zipping of ODT documents in python # Source ODT file "in.odt" shall exist in "/tmp" # If ODT file contains string token, it will be replaced with string replacement #
As you probably know, ODT files of OpenOffice.org (LibreOffice) are in essence just ZIP archives.
It is very easy to unpack them. But it is not so easy to create them. If you simply zip the contents of unpacked ODT and change the extension to .odt, it will not work.
The key here is that the mimetype file shall come into the archive first.
Two simple bash scripts are given here to extract and then pack back the ODT files.
Script odt_extract (provide .odt file name and desired destination directory as command line arguments):
echo "Extracting ODT file $1 to directory $2 ..."
unzip "$1" -d "$2" #1>/dev/null
Script odt_compress (provide source directory and desired .odt file name as command line arguments):
echo "Compressing contents of directory $1 into ODT compatible document $2 ... "
# Move into document source directory
# Special zipping procedure to create correctly structured ODT file
# Remember that if the provided resulting file path is relative, it shall be so in respect to the current working directory!
# First comes the "mimetype" file ...
zip -0 -X "$2" mimetype #1>/dev/null
# ... then everything else follows
zip -r "$2" * -x mimetype #1>/dev/null
To use SQLite database with OpenOffice.org or LibreOffice:
sudo apt-get install unixodbc unixodbc-bin
sudo apt-get install libsqliteodbc
ODBCCreateDataSourceQ4 (create data source for “user”)
ODBCManageDataSourcesQ4 (if needed)
First register the database in Base, then go on using it in Calc and Writer
Connect to an existing database -> ODBC
View -> Data sources
View -> Data sources
If for any reason the configuration fails, you can try to set it up manually.
First, edit file /etc/odbcinst.ini and enter database driver data, like this:
[SQLite3] Description=SQLite3 ODBC Driver Driver=/usr/lib/i386-linux-gnu/odbc/libsqlite3odbc.so Setup=/usr/lib/i386-linux-gnu/odbc/libsqlite3odbc.so Threading=2
Then enter database specific parameters in a hidden file .odbc.ini in your user directory (if the database is to be used by a single user), e.g.:
[myTest] Description=My test database Driver=SQLite3 Database=/home/user/Databases/mytest.db Timeout=2000