0

I have options of various length, so sometimes they go over the page. Is there an option on csvreader to split pages, similar to longtable?

Sample code:

\documentclass[a4paper,12p]{article}

%%% select the required data %%%%
% select hospital name
\newcommand{\hospital} {Hospital} 

%Pricelist name
\newcommand{\pricelist}{RFD_MTSV}

%%%%%%% DON'T ALTER FROM HERE ONWARDS (except spacing and layout)%%%%
\newcommand{\system}{\csvreader[filter equal={\csvcoli}{2}]{\excel}{2=\sys}{\sys}}
\newcommand\systemf{\csvreader[filter equal={\csvcoli}{2}]{\excel}{2=\sys}{\edef\MySystem{\sys}}}

\usepackage{graphicx}       %% allow graphics

\usepackage{xcolor}                   %% allow colour
\definecolor{teal}{RGB}{76,177,155}
\definecolor{light-gray}{gray}{0.4}

\usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins

\usepackage{fancyhdr}       %% allow header, footer
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\fancyhf{}
\fancyheadoffset{1 cm}
\fancyfootoffset{1 cm}
\lhead{\textcolor{teal} {\monthyeardate\today}}
\chead{\textcolor{light-gray}{\hospital \, (System)}}
\rhead{\textcolor{light-gray} {page \thepage}}
\lfoot{\textcolor{light-gray} {38 years }}
\rfoot{\bfseries \textcolor{light-gray} {Company}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\fancypagestyle{firstpage}{% first page different
\lhead{}
\chead{}
\rhead{}
\renewcommand{\headrulewidth}{0pt}
    \lfoot{\textcolor{light-gray} {38 years}}
    \rfoot{\bfseries \textcolor{light-gray} {Company}}
    \renewcommand{\footrulewidth}{0.4pt}}


\usepackage{datetime} % dates - my altered dates below
\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH] \THEYEAR} %just month written and Year

\newdateformat{normal}{%
  \longdate \ordinaldate{\THEDAY} \monthname[\THEMONTH] \THEYEAR} %normal date

\newcommand\twodigits[1] {\ifnum#1<10 0#1\else #1\fi}
\newdateformat{quoteNo}{%
   \THEYEAR--\twodigits{\THEMONTH}--\twodigits{\THEDAY} } % digit date for quote no.

\usepackage{fontawesome} % phone symbols
\usepackage{marvosym} % LinkedIn and Facebook symbols

\usepackage{hyperref} %hyperlinks

\usepackage{tabularx} % for the table format
\newcommand\mce{\multicolumn{1}{c}{}}
\newcounter{RowNum}
\usepackage{siunitx} %counting row numbers

\usepackage{advdate} % quote expiry

\usepackage[none]{hyphenat} % don't hyphenate

\usepackage{csvsimple} % read Excel tables
\newcommand{\excel} {\pricelist.csv}
\newcommand{\comma}{, }
\newcommand{\commano}{,}
\newcommand{\nc}{&}
\newcommand{\ns}{\,}

\usepackage{enumitem} % dot points with indent
\newenvironment{myitemize}{%
    \itemize[leftmargin=!,labelindent=5pt,itemindent=-10pt]
}{%
    \enditemize
}

\usepackage{longtable} %table over 2 pages

\begin{document}
\setlength{\parindent}{0pt} % never indent first line

\color{light-gray}{%
\subsubsection*{\underline{OPTIONAL ITEMS AVAILABLE}}
\vspace{0.4cm} % adjust spacing here

%\begin{longtable} %doesn't work
\csvreader[tabular = >{\stepcounter{RowNum}\theRowNum}r >{\everypar{\hangindent0.7cm}}p{12cm} b{1.3cm}, filter ifthen=\equal{\csvcolii}{1}]{\excel}{17=\dbo, 18=\deo, 15=\pricel,16=\pricer}{& \textbf{\dbo} \deo & \mce  \\ 
\mce   && \$  \hfill \ifthenelse{\equal{\pricel}{0}}{}{\pricel,}\pricer \\ \mce}
%\end{longtable}
}
\color{black}

%\hrulefill %remove if necessary


%\vspace{-0.1cm} % adjust spacing here

\textbf{Delivery Time:} Approximately 8 weeks after placement of order\\

\textbf{Payment terms:} Full payment is required no later than 30 days from date of installation. \\
\begin{minipage}{1cm}{} \end{minipage}\hspace{1cm}\begin{minipage}[t]{0.01cm}{\footnotesize{*}} \end{minipage}\hspace{-0.7cm}\begin{minipage}[t]{15cm} {\begin{quote} \footnotesize{Any moneys outstanding after this period will be charged at 20\,\% interest from the date of delivery.} \end{quote}}\end{minipage}\\

\textbf{GST:} Unless otherwise stated, all prices in this quote are excluding GST.\\

\textbf{Quotation expiry:}\normal{\AdvanceDate[28] \today}

\end{document}

Which gives me following page layout: enter image description here

1 Answer 1

0

I found out, that a simple exchange can split pages:

\csvreader[longtable= >{\stepcounter{RowNum}\theRowNum}r >{\everypar{\hangindent0.7cm}}p{12cm} b{1.3cm}, filter ifthen=\equal{\csvcolii}{1}]{\excel}{17=\dbo, 18=\deo, 15=\pricel,16=\pricer}{& \textbf{\dbo} \deo & \mce  \\ 
\mce   && \$  \hfill \ifthenelse{\equal{\pricel}{0}}{}{\pricel,}\pricer \\ \mce}

I would love comments of how to implement headers though (not for this example), but working on another project...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.