There is a similar question and solution posted here. However, I can't use this solution as I have a coloured table, and the given solution causes white gaps between each column.
Is there a way to fit a coloured long table to the width of a page (including landscape pages) so that the row colouring is maintained?
Here is an example of my current code:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{float}
\usepackage{array}
\usepackage{longtable}
\restylefloat{table}
\definecolor{Gray}{gray}{0.65}
\definecolor{Blue}{RGB}{0,176,240}
\definecolor{light-gray}{gray}{0.90}
% Margins
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=8.5in
\headsep=0.25in
\linespread{1.1} % Line spacing
\newcommand{\specialcell}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\newcommand\setrowfont[1]{\noalign{\gdef\rowfont{#1}}}
\gdef\rowfont{}
\makeatletter
\newcommand*{\@rowstyle}{}
\newcommand*{\rowstyle}[1]{% sets the style of the next row
\gdef\@rowstyle{#1}%
\@rowstyle\ignorespaces%
}
\newcolumntype{=}{% resets the row style
>{\gdef\@rowstyle{}}%
}
\newcolumntype{+}{% adds the current row style to the next column
>{\@rowstyle}%
}
\newcolumntype{C}{>{\rowfont}c}
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
\renewenvironment{longtable}{\rowcolors{2}{light-gray}{Gray}\oldlongtable} {
\endoldlongtable}
\begin{document}
% Normal
\setlength\LTcapwidth{\textwidth}
\setlength\LTleft{-10cm plus -1fill}
\setlength\LTright{\LTleft}
\begin{longtable}{=C+C+C}
\rowcolor{Blue}
\rowstyle{\color{white}}
A & B & C \\
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{longtable}
% To page width but has white gaps between columns
\setlength\LTcapwidth{\textwidth}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{longtable}{@{\extracolsep{\fill}}=C+C+C}
\rowcolor{Blue}
\rowstyle{\color{white}}
A1 & B1 & C1 \\
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{longtable}
\end{document}
Generates:


\documentclass{...}, the required\usepackage's,\begin{document}, and\end{document}. – karlkoeller Feb 17 '14 at 09:47