7

I need a dynamic solution to produce questionnaires from a database of questions which gets updated from time to time. I thought of LaTeX for set out the layout but the question is whether LaTeX can import specified fields of an Acces or Excel or whatsoever external "database".

I also thought about WORD Macros and .NET programming, but I preferred LaTeX.

Guido
  • 30,740
  • 1
    Is there a possibility to export in a plain text format, for example .csv? This is readily handled by TeX (provided the file is not too big!), but direct access to binary structures realistically requires LuaTeX. – Joseph Wright Sep 10 '12 at 14:24
  • Maybe you can use SQLTeX. Alternatively, you might be interested in the @EASE system which is part of the AcroTeXtools. – Martin Heller Sep 11 '12 at 20:25

2 Answers2

3

If "whatsoever external database" may be a plain text file like this data.dat example:

Mr.
Peter
Smith
Newtown Road, Los Angeles, USA
209 \$


Ms. 
Maria 
Rossi
Regina Elena, 113, Milano, Italy
145 \euro

Where simply the field separators are carriage returns, then you can merge with a LaTeX document with the textmerg package as in this MWE:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} 
\usepackage{eurosym}
\usepackage{textmerg} 
\begin{document}

\Fields{\Mr\Name\SurName\Address\Donation} 

{\bf Cots of donations to some good cause:}
\vspace{2ex}

\Merge{data.dat}{

\begin{tabular}{r|l}
Person & {\bf \Mr\ \Name\  \SurName }\\
Address & {\bf \Address }\\
Cost & {\bf \Donation } \\
\end{tabular}
\vspace{2ex}

}
\end{document}
David Carlisle
  • 757,742
Fran
  • 80,769
1

Have a look at nlatexdb, I found it very useful.

http://www.ctan.org/pkg/nlatexdb

Geoff
  • 2,637