summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex
blob: 12566e4aba0eaa5fdc300735c6681d6f4f8d4fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 % This file is public domain.
\documentclass{letter}

\usepackage{datatool}

\DTLloaddb{data}{sample-student-records.csv}

\begin{document}
\begin{DTLenvforeach*}{data}{\Title=Title,\FirstName=First Name,\Surname=Surname,\AssignmentI=Assignment 1,\AssignmentII=Assignment 2,\AssignmentIII=Assignment 3,\Address=Address}
\begin{letter}{\Title\space\FirstName\space\Surname\\\Address}
\opening{Dear \Title~\Surname}

\DTLmeanforall{\Score}{\AssignmentI,\AssignmentII,\AssignmentIII}
\DTLround{\Score}{\Score}{0}\DTLclip{\Score}{\Score}%
You were awarded a mark of \Score\%.

\closing{Yours Sincerely}
\end{letter}

\end{DTLenvforeach*}
\end{document}