emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Mail merge in isodoc class (with datatool... and Org)


From: Sébastien Vauban
Subject: [Orgmode] Mail merge in isodoc class (with datatool... and Org)
Date: Wed, 22 Sep 2010 00:02:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hi Eric,

Going on within the _tangle_ route, I've managed getting *mail merge* working
from Org, by using the =isodoc= class with the LaTeX package =datatool=.

--8<---------------cut here---------------start------------->8---
#+TITLE:     Org-isodoc
#+AUTHOR:    Seb Vauban
#+DATE:      2010-09-21
#+LANGUAGE:  en_US

* To
  :PROPERTIES:
  :ID:       bfd9e2af-1033-4bf0-a0d1-5757afd9c9a1
  :END:
#+begin_src csv :tangle addresses.csv
FirstName,LastName,Address,PostCode,Town
Albert,ARTHUR,Rue1,1100,Albertville
Beatrice,BENJAMIN,Rue2,2020,Bigard
Christophe,CASTAGNE,Rue3,3003,Calais
Damien,DURAND,Rue4,4440,Dunkerque
#+end_src

* Subject
  :PROPERTIES:
  :ID:       72e05a4c-13b5-48e3-b326-8868a7ab0f09
  :END:
#+srcname: subject
#+begin_src org :results latex
Composing letters using Org mode and the LaTeX isodoc class
#+end_src

* Opening
  :PROPERTIES:
  :ID:       123be106-665b-4da9-9009-769987713f87
  :END:
#+srcname: opening
#+begin_src org :results latex
Dear Org mode users,
#+end_src

* Body
  :PROPERTIES:
  :ID:       3ccb6126-c3d4-4e5f-b630-ef3086d15ca2
  :END:
#+srcname: body
#+begin_src org :results latex
*Problems* encountered /so far/:
- how to insert properly converted tables (to LaTeX)?
  | test | hello |
  | foo  | bar   |
- begin an Org block, editing this code adds commas in front of every line...

That's all for now.
#+end_src

* Closing
  :PROPERTIES:
  :ID:       53486f96-916a-4900-9e01-c27e9661d184
  :END:
#+srcname: closing
#+begin_src org :results latex
Yours Truly
#+end_src

* Encl
  :PROPERTIES:
  :ID:       61870a22-46b7-4446-ab0f-c17ebb36c632
  :END:
#+srcname: encl
#+begin_src org :results latex
I still have to look at how to declare some attached documents.
#+end_src

* Letter
  :PROPERTIES:
  :ID:       b9db447c-0347-414e-a555-edf2ddafdbc3
  :END:
#+begin_src latex :noweb yes :tangle yes
\documentclass[11pt]{isodoc}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{datatool}
\DTLloaddb{addresses}{addresses.csv}

\usepackage{isodoc-style}

\setupdocument{
    subject = {%
      <<subject()>>},
    opening = {%
      <<opening()>>},
    closing = {%
      <<closing()>>}
}

\begin{document}
\DTLforeach{addresses}{%
  \firstname=FirstName,%
  \lastname=LastName,%
  \addressi=Address,%
  \postcode=PostCode,%
  \town=Town%
}{%
\letter[to={\firstname~\lastname\\\addressi\\\postcode~\town}]{%
<<body()>>
}}
\end{document}
#+end_src
--8<---------------cut here---------------end--------------->8---

I'm sure there are other ways, as you said...

>> next step: be able to produce /mail merge/ ("publiposting"), having in Org
>> the list of recipients and the letter's contents -- both in one unique Org
>> file --, and producing all the letters at once (in one PDF), just by =C-c
>> C-v C-e=...
>
> this shouldn't be impossible with the current setup, maybe use sbe to call a
> code block on every row of a table with the table holding the recipients.
> Certainly wouldn't be trivial though.

... but this is a first (working) step!

Comments, patches, ideas, better ways... all are welcome...

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]