For a template I'm creating at the moment I need a table with alternating rowcolors in the first two columns and one multirow (third column) containing an image. This multirow should not react to the rowcolors command. Here is an example image of a table created with Word.
In addition to that the content of the table gets inserted by using variables (MWE). If a variable gets no value (is empty) the whole line of the table should disappear.
Normally I have to color every cell by hand because rowcolors and multirow apparently don't work well together. Since the rows disappear if their variable is left empty the rowcolors are likely to get out of order after each entry. Is there any way to get alternating rowcolors and a multirow in a table without having to change the cellcolor manually each time?
Thanks a lot for your help and sorry for my English ...
\documentclass[a4paper,pagesize]{scrartcl}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{array}
\usepackage{color}
\usepackage[table]{xcolor}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\def\leer{}
\def\FirstRow{Row1}
\def\SecondRow{Row2}
\def\ThirdRow{Row3}
\def\FourthRow{}
\def\FifthRow{Row5}
\def\SixthRow{Row6}
\begin{table}[ht] \centering
\renewcommand{\arraystretch}{2}
%\rowcolors{1}{}{blue}
\begin{tabular}{| >{\bfseries}M{.15\textwidth} | M{.25\textwidth} | M{.4\textwidth} |}
\hline
\rowcolors{1}{blue}{white}
\ifx\FirstRow\leer \else FirstRow & \FirstRow & \multirow{5}{*}{\includegraphics[width=.4\textwidth]{example-image-golden}} \\ \hhline{--~|} \fi
\ifx\SecondRow\leer \else SecondRow & \SecondRow & \\ \hhline{--~|} \fi
\ifx\ThirdRow\leer \else ThirdRow & \ThirdRow & \\ \hhline{--~|} \fi \rowcolor{blue}
\ifx\FourthRow\leer \else FourthRow & \FourthRow & \\ \hhline{--~|} \fi
\ifx\FifthRow\leer \else FifthRow & \FifthRow & \\ \hhline{--~|} \fi
\ifx\SixthRow\leer \else SixthRow & \SixthRow & \\ \hline \fi
\end{tabular}
\end{table}
\end{document}