Bug 208164 - Generate Letters in odf format
Summary: Generate Letters in odf format
Status: RESOLVED NOT A BUG
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-22 11:41 UTC by Viktor Engelmann
Modified: 2009-09-22 22:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
bash-script that applies sed to the content of an odf file (765 bytes, text/plain)
2009-09-22 11:45 UTC, Viktor Engelmann
Details
bash-script that applies sed to the content of an odt file multiple times (898 bytes, text/plain)
2009-09-22 22:45 UTC, Viktor Engelmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Viktor Engelmann 2009-09-22 11:41:36 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

kaddressbook should be able to create letters to contacts in odf format. you could do it like this:

have a directory for odf template-files (you could have subdirs according to different $LANG values). the odf format would allow you to create the template files using oowriter and just writing something like %ownaddress% %address% etc in places where you want them to be put. then you'd just have to unzip the template file, change the file content.xml using sed (replacing %address% with the address taken from kaddressbook etc), zipping it to some temporary location and opening it in oowriter

I wrote a bash script for that purpose, that I'll give you (btw: you should make shure that the replacements don't contain a / or something that would confuse sed)
Comment 1 Viktor Engelmann 2009-09-22 11:45:00 UTC
Created attachment 37110 [details]
bash-script that applies sed to the content of an odf file

it unzipps $1 to a temporary location, replaces $2 by $3 in the content.xml file (using sed) and zipps it to $4
Comment 2 Tobias Koenig 2009-09-22 13:31:04 UTC
Hej,

the clean (and IMHO correct) solution would be to use the
mailmerge feature of KWord to create such letters.
I guess the current mailmerge version in KWord doesn't work
with the new Akonadi based address books, but that is something
else to fix. Nothing KAddressBook is responsible for.

Ciao,
Tobias
Comment 3 Viktor Engelmann 2009-09-22 22:40:08 UTC
I don't think you understood me right - I'm not talking about sending the same letter to multiple people, I mean you should be able to right-click on an address, select "send letter" (like you can select an email address and choose to create an email with the selected address as recipient)
It should then open kword or oowriter or whatever is used to open odt files like email addresses open the mailclient with the selected address

For one single letter, you really shouldn't have to start the wordprocessor manually and go through multiple dialogs just to get that one address out of the database...

I mentioned the templates because you could have different kinds of letters (personal letters, business letters that have the company logo etc.) so you should have something like ~/Documents/OpenOfficeTemplates/en_EN/business_letter.odt
(or is the file extension different for templates? like word had ".dot"?)
Comment 4 Viktor Engelmann 2009-09-22 22:45:33 UTC
Created attachment 37115 [details]
bash-script that applies sed to the content of an odt file multiple times

using this script you can replace all placeholders in just one call. e.g.

odt_sed.sh <templatefile> <destinationfile> "%name%" "John Doe" "%zipcode%" "1337" ...