Libreoffice is not using my gtk theme

LibreOffice was not using my gtk theme (on my devuan netinst, fluxbox, with xfce4-settings-manager, chtheme, and manually written .config/gtk-3.0/settings.ini).

basic interface for libreoffice writer
No theming for Writer

Turns out you simply need to install an additional package:

sudo apt-get install libreoffice-gtk3
libreoffice writer with gtk3 theming
Writer with gtk3 theme applied

Devuan also has a libreoffice-gtk2 package, which I didn’t try.
I haven’t tried a Fedora minimal/net install with Fluxbox and LibreOffice, so I don’t know if the libreoffice-gtk3 rpm is necessary there, but it’s in the repos.

sudo dnf install libreoffice-gtk3

I was impressed by this behavior. Just install an extra .so file, and boom, LibreOffice integrates with your desktop theme. LibreOffice is some great stuff!

References

Ripped off from How to change themes [closed] – Ask LibreOffice

Insert filename in Libreoffice Calc spreadsheet ods file in Linux

In LibreOffice Writer, you can use the “Insert Field” tool to easily insert the filename into the document. In Calc, it’s a little different, but still possible. You can access the raw filename and sheet with CELL(“filename”). To make it pretty, use a longer formula.

=LEFT(REPLACE(LEFT(CELL("filename"),FIND("'",CELL("filename"),2)),1,9,"/"),LEN(REPLACE(LEFT(CELL("filename"),FIND("'",CELL("filename"),2)),1,9,"/"))-1)

References

  1. https://listarchives.libreoffice.org/global/users/msg24734.html
  2. search libreoffice calc insert filename

Grep odt file

Overview

In the GNU/Linux world, you spend a lot of time on the command line. Searching a text file is a piece of cake:
grep -iE "expression" file1

You might even use a gui, and inside that gui you might even use an open-source office suite for all those times that plain text isn’t enough. But what about when you want to search one of those odt files you vaguely remember is some form of xml?

Easy. You use unoconv or odt2txt (look those up in your package manager) and then grep the outputted file. Or you can use the –stdout option.

unoconv -f txt foo.odt

unoconv -f txt --stdout foo.odt | grep -iE "Joe Schmoe"

History

I first started tackling this problem by figuring out how to access the xml inside. I learned an odt file is zipped, but a tar xf didn’t help. Turns out it was some other compression, that unzip manages.

I also had to actually learn the tiniest bit of perl, as regular GNU grep (and I inferred sed) doesn’t do non-greedy wildcard matching.

So I got this super-complicated one-liner going before I decided to try a different approach and discovered the unoconv and odt2txt applications.

time unzip -p foo.odt content.xml | sed -e 's/\([^n]\)>\n(.*)<\/\1>/\2/;s/<text:h.*?>(.*)<\/text:h>/\1/;' -e 's/<style:(font-face|text-properties).*\/>//g;' | sed -e "s/'/\'/g;s/"/\"/g;s/<text:.*break\/>//g;"

 

References

Weblinks

  1. Unzipping an odt file https://ubuntuforums.org/showthread.php?t=899179&s=3aa7c303c4a5655e039600c4082d7a2c&p=5653494#post5653494
  2. Perl non-greedy wildcard matching http://stackoverflow.com/a/1103177/3569534