2

I need to show Excell table below in landscpe mode including the colours of each cell.

I have used \begin{landscape} and \end{landscape} but I couldn't fix all the data in the same page.

Also I used the software excel2latex (http://www.ctan.org/pkg/excel2latex) still I didn't get the colours in the cell. So any suggestions to do this?

enter image description here

Code using excel2latex

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|r|}
\multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} &        \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} &    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \\ \multicolumn{1}{r}{} & \multicolumn{20}{c}{\textbf{all data}} \bigstrut[b]\\
\cline{4-6}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} &      & \multicolumn{3}{c|}{\textbf{h}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{3-6}    \multicolumn{1}{r}{} &      & \textbf{ggg} & \multicolumn{1}{c|}{\textbf{y}} & \multicolumn{1}{c|}{\textbf{n}} & \multicolumn{1}{c|}{\textbf{m}} & \multicolumn{1}{c}{\textbf{}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{3-6}    \multicolumn{1}{r}{} &      & \multicolumn{1}{c|}{\textbf{ggg}} & h    & h    & h    & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{3-6}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{c}{\textbf{}} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{4-21}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{}} & \multicolumn{7}{c|}{\textbf{h}}                & \multicolumn{2}{c|}{\multirow{2}[4]{*}{\textbf{h1}}} & \multicolumn{2}{c|}{\multirow{2}[4]{*}{\textbf{n5}}} & \multicolumn{6}{c|}{\textbf{n}}         & \multirow{3}[6]{*}{\textbf{gh}} \bigstrut\\
\cline{4-10}\cline{15-20}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{\textbf{ri}} & \textbf{} & \multicolumn{3}{c|}{\textbf{ui}} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{3}{c|}{\textbf{n}} & \multicolumn{3}{c|}{\textbf{t}} &  \bigstrut\\
\cline{4-20}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{y}} & \multicolumn{1}{c|}{\textbf{u}} & \multicolumn{1}{c|}{\textbf{u}} & \multicolumn{1}{c|}{\textbf{}} & \multicolumn{1}{c|}{\textbf{y}} & \multicolumn{1}{c|}{\textbf{u}} & \multicolumn{1}{c|}{\textbf{y}} & \multicolumn{1}{c|}{\textbf{vr}} & \multicolumn{1}{c|}{\textbf{vrq}} & \multicolumn{1}{c|}{\textbf{gg}} & \multicolumn{1}{c|}{\textbf{gg1}} & \multicolumn{1}{c|}{\textbf{X}} & \multicolumn{1}{c|}{\textbf{Y}} & \multicolumn{1}{c|}{\textbf{Z}} & \multicolumn{1}{c|}{\textbf{G1}} & \multicolumn{1}{c|}{\textbf{G2}} & \multicolumn{1}{c|}{\textbf{G3}} &  \bigstrut\\
\cline{2-21}         & \multicolumn{1}{c|}{\multirow{7}[14]{*}{\begin{sideways}\textbf{s0}\end{sideways}}} & \multicolumn{1}{c|}{\textbf{Case1}} & 9,818.091 & 15,528.853 & 5,943.130 &      & 9,820.620 & 15,517.796 & 5,921.472 & 9592749 & 4455363 & \multicolumn{1}{c|}{\textbf{gh}} & \multicolumn{1}{c|}{\textbf{nm}} & 9806.935 & 14929.498 & 6028.766 & 0.1429 & 0.1429 & 0.1823 & 230113 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case2}} & 9,840.623 & 15,531.109 & 5,962.314 &      & 9,818.091 & 15,528.853 & 5,943.130 & 9760756 & 7645252 & \multicolumn{1}{c|}{\textbf{gh}} & \multicolumn{1}{c|}{\textbf{nm}} & 9823.971 & 14997.728 & 6038.548 & 0.1429 & 0.1429 & 0.1796 & 4230358 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case 3}} & 9,832.170 & 15,525.640 & 5,983.492 &      & 9,840.623 & 15,531.109 & 5,962.314 & 11842651 & 8800367 & \multicolumn{1}{c|}{\textbf{gh}} & \multicolumn{1}{c|}{\textbf{nm}} & 9839.780 & 15069.009 & 6048.734 & 0.1429 & 0.1429 & 0.1870 & 8244914 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case4}} & 9,838.951 & 15,516.830 & 6,002.379 &      & 9,832.170 & 15,525.640 & 5,983.492 & 11476155 & 10577546 & \multicolumn{1}{c|}{\textbf{bn}} & \multicolumn{1}{c|}{\textbf{nm}} & 9835.462 & 15130.676 & 6057.545 & 0.1429 & 0.1429 & 0.1874 & 10657573 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case5}} & 9,834.968 & 15,528.034 & 6,023.395 &      & 9,838.951 & 15,516.830 & 6,002.379 & 11888910 & 11497805 & \multicolumn{1}{c|}{\textbf{bn}} & \multicolumn{1}{c|}{\textbf{nm}} & 9839.694 & 15209.853 & 6068.854 & 0.1429 & 0.1429 & 0.2165 & 12980114 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case6}} & 9,842.123 & 15,511.853 & 6,042.983 &      & 9,834.968 & 15,528.034 & 6,023.395 & 13104314 & 11077112 & \multicolumn{1}{c|}{\textbf{bn}} & \multicolumn{1}{c|}{\textbf{nm}} & 9838.313 & 15270.315 & 6077.492 & 0.1429 & 0.1429 & 0.2098 & 14981855 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case7}} & 9,838.533 & 15,525.413 & 6,063.707 &      & 9,842.123 & 15,511.853 & 6,042.983 & 13726339 & 12531040 & \multicolumn{1}{c|}{\textbf{bn}} & \multicolumn{1}{c|}{\textbf{nm}} & 9843.389 & 15349.671 & 6088.822 & 0.1429 & 0.1429 & 0.2826 & 18080650 \bigstrut\\
\cline{2-6}\cline{8-21}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{2-6}\cline{8-21}         & \multicolumn{1}{c|}{\multirow{7}[14]{*}{\begin{sideways}\textbf{f}\end{sideways}}} & \multicolumn{1}{c|}{\textbf{Case8}} & 9,838.533 & 15,525.413 & 6,063.707 &      & 9,841.863 & 15,504.792 & 6,083.575 & 14136489 & 10634104 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9839.985 & 15408.858 & 6097.282 & 0.1429 & 0.2880 & 0.1429 & 17897382 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case9}} & 9,841.863 & 15,504.792 & 6,083.575 &      & 9,840.487 & 15,521.042 & 6,104.712 & 12412127 & 9183095 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9842.010 & 15490.985 & 6109.011 & 0.1429 & 1.8422 & 0.1429 & 16081101 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case10}} & 9,840.487 & 15,521.042 & 6,104.712 &      & 9,846.451 & 15,501.936 & 6,123.909 & 10052428 & 8461151 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9839.964 & 15548.367 & 6117.211 & 0.1429 & 0.4573 & 0.1429 & 13924538 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case11}} & 9,846.451 & 15,501.936 & 6,123.909 &      & 9,850.112 & 15,527.268 & 6,144.418 & 9558234 & 7256645 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9843.121 & 15632.950 & 6129.287 & 0.1429 & 0.1720 & 0.1429 & 12763883 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case12}} & 9,850.112 & 15,527.268 & 6,144.418 &      & 9,853.493 & 15,501.562 & 6,164.579 & 7789213 & 7661257 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9845.306 & 15690.717 & 6137.531 & 0.1429 & 0.1936 & 0.1429 & 11271788 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case13}} & 9,853.493 & 15,501.562 & 6,164.579 &      & 9,857.259 & 15,525.142 & 6,184.610 & 8357971 & 5514848 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9843.698 & 15772.511 & 6149.218 & 0.1429 & 0.1810 & 0.1429 & 9590775 \bigstrut\\
\cline{3-6}\cline{8-21}         & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Case14}} & 9,857.259 & 15,525.142 & 6,184.610 &      & 9,863.145 & 15,500.162 & 6,204.046 & 6900908 & 3815794 & \multicolumn{1}{c|}{\textbf{hj}} & \multicolumn{1}{c|}{\textbf{nm}} & 9844.111 & 15827.972 & 6157.136 & 0.1429 & 0.2120 & 0.1429 & 5986677 \bigstrut\\
\cline{2-6}\cline{8-21}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{2-6}\cline{8-21}         & \multicolumn{1}{c|}{\textbf{g}} & \multicolumn{1}{c|}{\textbf{Case15}} & 9,863.145 & 15,500.162 & 6,204.046 &      & 9,861.849 & 15,521.812 & 6,224.877 & 5087450 & 3509310 & \multicolumn{1}{c|}{\textbf{nm}} & \multicolumn{1}{c|}{\textbf{nm}} & 9845.491 & 15911.864 & 6169.106 & 0.1429 & 0.2027 & 0.1429 & 3794748 \bigstrut\\
\cline{2-6}\cline{8-21}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{2-6}\cline{8-12}         & \multicolumn{1}{c|}{\textbf{A3}} & \multicolumn{1}{c|}{\textbf{Case16}} & 9,861.849 & 15,521.812 & 6,224.877 &      & 9,878.129 & 15,504.200 & 6,243.582 & 3953560 & 3190632 & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut\\
\cline{2-6}\cline{8-12}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \bigstrut[t]\\
    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} &  \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{}  \\
    \end{tabular}%
    \label{tab:addlabel}%
    \end{table}%
4
  • Maybe use a smaller font size. For colours, you have the \rowcolor command, from colortbl and the xcolor package.
    – Bernard
    Dec 3, 2014 at 0:32
  • 1
    That code is evil. Do you have to use that tool? Insert columns with & and copy paste that stuff. It's much more easier than handling this
    – percusse
    Dec 3, 2014 at 0:34
  • @percusse how about the colours of cells and fitting all data in to one page?
    – Harry
    Dec 3, 2014 at 0:53
  • @percusse I used ctan.org/pkg/excel2latex
    – Harry
    Dec 3, 2014 at 1:09

1 Answer 1

2

The table you want will be nearly illegible given default page margins. Related post: What is the recommended font to use for a statistical table in an academic journal?. I'd strongly recommend coming up with a different table design, or compromising elsewhere (for example, do you need 7-8 significant digits on your values?).

enter image description here

MWE with widest numbers from each column placed side by side to show worst-case spacing, and using booktabs and siunitx:

\documentclass{article}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{colortbl}

\setlength{\tabcolsep}{4pt}

\begin{document}

\begin{sidewaystable}
\tiny % roughly 7pt in a 10pt document -- stays within margins
%\scriptsize % roughly 8pt in a 10pt document -- overflows margins
\begin{tabular}{
c
c
S[table-format=4.3]
S[table-format=5.3]
S[table-format=4.3]
S[table-format=4.3]
S[table-format=5.3]
S[table-format=4.3]
S[table-format=8.0]
S[table-format=8.0]
c
c
S[table-format=4.3]
S[table-format=5.3]
S[table-format=4.3]
S[table-format=1.4]
S[table-format=1.4]
S[table-format=1.4]
S[table-format=8.0]}
& & \multicolumn{6}{c}{h} & & & & & \multicolumn{6}{c}{n} \\
\cmidrule(lr){3-8} \cmidrule(l){13-18}
& & \multicolumn{3}{c}{ri} & \multicolumn{3}{c}{ui} & \multicolumn{2}{c}{h1} & \multicolumn{2}{c}{n5}  & \multicolumn{3}{c}{n} & \multicolumn{3}{c}{t} \\
\cmidrule(r){3-5} \cmidrule(lr){6-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12} \cmidrule(lr){13-15} \cmidrule(l){16-18}
& & {y} & {u} & {u} & {y} & {u} & {y} & {vr} & {vrq} & {gg} & {gg1} & {X} & {Y} & {Z} & {G1} & {G2} & {G3} & {gh} \\ \midrule
\rowcolor[gray]{.9} \cellcolor[gray]{1} & {Case 1} & 9818.091 & 15528.853 & 59493.130 & 9820.620 & 15517.796 & 5921.472 & 11842651 & 10577546 & {gh} & {nm} & 9806.935 & 14929.498 & 6028.766 & 0.1429 & 0.1429 & 0.1823 & 10657573 \\
% \multirow{-2} trick from http://texblog.org/2014/05/19/coloring-multi-row-tables-in-latex/
\rowcolor[gray]{.9} \cellcolor[gray]{1} \multirow{-2}{*}{\(s_0\)} & {Case 1} & 9818.091 & 15528.853 & 59493.130 & 9820.620 & 15517.796 & 5921.472 & 11842651 & 10577546 & {gh} & {nm} & 9806.935 & 14929.498 & 6028.766 & 0.1429 & 0.1429 & 0.1823 & 10657573 \\
\end{tabular}
\caption{Giant table}
\end{sidewaystable}
\end{document}
2
  • How about the cell colours?
    – Harry
    Dec 3, 2014 at 1:54
  • Something like \rowcolor[rgb]{0.8,0.6,0.4} instead of \rowcolor[gray]{0.9}, but it won't help legibility. Dec 3, 2014 at 2:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .