emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Mail merge in isodoc class (with datatool... and Org)
@ 2010-09-21 22:02 Sébastien Vauban
  0 siblings, 0 replies; only message in thread
From: Sébastien Vauban @ 2010-09-21 22:02 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-21 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-21 22:02 Mail merge in isodoc class (with datatool... and Org) Sébastien Vauban

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).