# How to add background color to a single row which contains multicolumns?

I want to add background color in the header part of my table which contains grouped columns:

\multicolumn{8}{ p{6.0in} }{ \textbf{ PARTNER } } & \hfill\textbf{ TOTAL PAYABLES }  \\


A simple \rowcolor does not color the whole row but the ungrouped column only. How to color the whole row?

• if you have a colortbl dated 2012 it should work – David Carlisle Sep 10 '13 at 7:15
• or if not use \cellcollor{blue} – David Carlisle Sep 10 '13 at 8:08

Using xcolor package:

\documentclass{report}
\usepackage[table]{xcolor}
\begin{document}
\noindent
\begin{table}
\begin{tabular}{|*9{c|}}
\rowcolor{gray!30}\multicolumn{8}{ |p{4.0in}|}{ \textbf{ PARTNER } } & \textbf{TOTAL PAYABLES}  \\
\end{tabular}
\end{table}
\end{document}


This will also work with colortbl (with the latest version as suggested by David)

\documentclass{report}
\usepackage{colortbl,xcolor}
\begin{document}
\noindent
\begin{table}
\begin{tabular}{|*9{c|}}
\rowcolor{gray!30}\multicolumn{8}{ |p{4.0in}|}{ \textbf{ PARTNER } } & textbf{TOTAL PAYABLES}  \\
\end{tabular}
\end{table}
\end{document}

• [table]{xcolor} is just telling xcolor to load colortbl so the two versions are the same really. – David Carlisle Sep 11 '13 at 9:19
• @DavidCarlisle: True. It is doing same thing differently ;-) Thanks . – user11232 Sep 11 '13 at 10:10