0

I would like some help in producing a table similar to the one shown the photo (photo1).

As the table was complicated to me, I am using an excel to latex converter plugin; but I am getting a distorted result (see photo2). Below is the script generated by the plugin.

Kindly help me arrange the script/code.

\documentclass[11pt]{report}

\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{array}
\usepackage{colortbl}
\usepackage{booktabs} 
\usepackage{tabulary}
\usepackage{array,longtable,multirow}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{soul} 
\usepackage{mathtools}
\usepackage{titlesec}

\begin{document}

    % Table generated by Excel2LaTeX from sheet 'Sheet1 (2)'
    \begin{table}[htbp]
      \centering
      \caption{Add caption}
        \begin{tabular}{||c|l||c|l||p{11.555em}|c|r||}
        \toprule
        \toprule
        \multicolumn{2}{||c||}{\multirow{2}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{RIBA Plan of Work 2013}}}} & \multicolumn{2}{c||}{\multirow{2}[4]{*}{\textbf{HOAI 2013 Service Profiles}}} & \multicolumn{3}{p{22.835em}||}{\textcolor[rgb]{ .753,  0,  0}{\textbf{SIA 112 Service Models}}} \\
    \cmidrule{5-7}    \multicolumn{2}{||c||}{} & \multicolumn{2}{c||}{} & \textcolor[rgb]{ .753,  0,  0}{\textbf{Sub-Phases}} & \multicolumn{2}{p{11.28em}||}{\textcolor[rgb]{ .753,  0,  0}{\textbf{Main Phases}}} \\
        \midrule
        \midrule
        \rowcolor[rgb]{ .949,  .949,  .949} \multirow{2}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{0}}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ .867,  .922,  .969}STRATEGIC DEFINITION}} & \multicolumn{1}{c}{\cellcolor[rgb]{ 1,  1,  1}} & \cellcolor[rgb]{ 1,  1,  1} & \cellcolor[rgb]{ .867,  .922,  .969}1.1 Formulation of requirements, solution strategies & \textcolor[rgb]{ .753,  0,  0}{\textbf{1}} & \multicolumn{1}{p{9.835em}||}{\cellcolor[rgb]{ .867,  .922,  .969}STRATEGIC PLANNING} \\
    \cmidrule{5-7}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \multicolumn{1}{c}{\cellcolor[rgb]{ 1,  1,  1}} & \cellcolor[rgb]{ 1,  1,  1} & \multirow{2}[4]{*}{\cellcolor[rgb]{ .867,  .922,  .969}2.1 Project definition and feasibility studies} & \multirow{4}[8]{*}{\textcolor[rgb]{ .753,  0,  0}{\textbf{2}}} & \multicolumn{1}{r||}{\multirow{4}[8]{*}{\cellcolor[rgb]{ .867,  .922,  .969}PRELIMINARY STUDIES}} \\
    \cmidrule{1-2}    \rowcolor[rgb]{ .949,  .949,  .949} \multirow{3}[6]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{1}}} & \multicolumn{1}{l||}{\multirow{3}[6]{*}{\cellcolor[rgb]{ .867,  .922,  .969}PREPARATION AND BRIEF}} & \multicolumn{1}{c}{\cellcolor[rgb]{ 1,  1,  1}} & \cellcolor[rgb]{ 1,  1,  1} & \multicolumn{1}{l|}{} &       &  \\
    \cmidrule{5-5}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \multicolumn{1}{c}{\cellcolor[rgb]{ 1,  1,  1}} & \cellcolor[rgb]{ 1,  1,  1} & \multirow{2}[4]{*}{\cellcolor[rgb]{ .867,  .922,  .969}2.2 Selection process} &       &  \\
    \cmidrule{3-4}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \multirow{2}[4]{*}{\textbf{1}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ .867,  .922,  .969}FUNDAMENTAL EVALUATION}} & \multicolumn{1}{l|}{} &       &  \\
    \cmidrule{1-2}\cmidrule{5-7}    \rowcolor[rgb]{ .949,  .949,  .949} \multirow{2}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{2}}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ 1,  .851,  .4}CONCEPT DESIGN}} &       &       & \multirow{2}[4]{*}{\cellcolor[rgb]{ 1,  .851,  .4}3.1 Preliminary project} & \multirow{6}[10]{*}{\textcolor[rgb]{ .753,  0,  0}{\textbf{3}}} & \multicolumn{1}{r||}{\multirow{6}[10]{*}{\cellcolor[rgb]{ 1,  1,  1}PROJECT PLANNING / CONFIGURATION}} \\
    \cmidrule{3-4}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \multirow{2}[4]{*}{\textbf{2}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ 1,  .851,  .4}PRELIMINARY DESIGN}} & \multicolumn{1}{l|}{} &       &  \\
    \cmidrule{1-2}\cmidrule{5-5}    \rowcolor[rgb]{ .949,  .949,  .949} \multirow{2}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{3}}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ 1,  .851,  .4}DEVELOPED DESIGN}} &       &       & \multirow{2}[4]{*}{\cellcolor[rgb]{ 1,  .851,  .4}3.2 Construction project} &       &  \\
    \cmidrule{3-4}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \textbf{3} & \multicolumn{1}{p{8.335em}||}{\cellcolor[rgb]{ 1,  .851,  .4}FINAL DESIGN} & \multicolumn{1}{l|}{} &       &  \\
    \cmidrule{1-5}    \rowcolor[rgb]{ .949,  .949,  .949} \multirow{2}[2]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{4}}} & \cellcolor[rgb]{ 0,  .69,  .314} & \multirow{2}[2]{*}{\textbf{4}} & \multicolumn{1}{l||}{\multirow{2}[2]{*}{\cellcolor[rgb]{ 0,  .69,  .314}PLANNING PERMISSION APPLICATION}} & \multirow{2}[2]{*}{\cellcolor[rgb]{ 0,  .69,  .314}3.3 Approval procedure} &       &  \\
        \rowcolor[rgb]{ .949,  .949,  .949}       & \multicolumn{1}{p{9.165em}||}{\cellcolor[rgb]{ .749,  .561,  0}TECHNICAL DESIGN} &       &       & \multicolumn{1}{l|}{} &       &  \\
        \midrule
        \rowcolor[rgb]{ .949,  .949,  .949} \multirow{3}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{5}}} & \multicolumn{1}{c||}{\multirow{3}[4]{*}{\cellcolor[rgb]{ 0,  .125,  .376}\textcolor[rgb]{ 1,  1,  1}{CONSTRUCTION}}} & \multirow{2}[2]{*}{\textbf{5}} & \multicolumn{1}{l||}{\multirow{2}[2]{*}{\cellcolor[rgb]{ .749,  .561,  0}EXECUSION PLANNING}} & \multirow{2}[2]{*}{\cellcolor[rgb]{ .8,  .4,  1}4.1 Tender, offer comparison, application for award} & \multirow{2}[2]{*}{\textcolor[rgb]{ .753,  0,  0}{\textbf{4}}} & \multicolumn{1}{r||}{\multirow{2}[2]{*}{\cellcolor[rgb]{ .8,  .4,  1}\textcolor[rgb]{ 1,  1,  1}{CALL FOR TENDER}}} \\
        \rowcolor[rgb]{ .949,  .949,  .949}       &       &       &       & \multicolumn{1}{l|}{} &       &  \\
    \cmidrule{3-7}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \textbf{6} & \multicolumn{1}{p{8.335em}||}{\cellcolor[rgb]{ .8,  .4,  1}\textcolor[rgb]{ 1,  1,  1}{PREPARATION OF CONTRACT AWARD}} & \cellcolor[rgb]{ .749,  .561,  0}5.1 Construction planning & \multirow{3}[6]{*}{\textcolor[rgb]{ .753,  0,  0}{\textbf{5}}} & \multicolumn{1}{r||}{\multirow{3}[6]{*}{\cellcolor[rgb]{ 1,  1,  1}REALIZATION/ IMPLEMENTATION}} \\
    \cmidrule{1-5}    \rowcolor[rgb]{ .949,  .949,  .949} \multirow{2}[4]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{6}}} & \multicolumn{1}{l||}{\multirow{2}[4]{*}{\cellcolor[rgb]{ 0,  .125,  .376}\textcolor[rgb]{ 1,  1,  1}{HANDOVER \& CLOSE OUT}}} & \textbf{7} & \multicolumn{1}{p{8.335em}||}{\cellcolor[rgb]{ .8,  .4,  1}\textcolor[rgb]{ 1,  1,  1}{INVOLVEMENT IN CONTRACT AWARD}} & \cellcolor[rgb]{ 0,  .125,  .376}5.2 Execution/ Implementation &       &  \\
    \cmidrule{3-5}    \rowcolor[rgb]{ .949,  .949,  .949}       &       & \textbf{8} & \multicolumn{1}{p{8.335em}||}{\cellcolor[rgb]{ 0,  .125,  .376}\textcolor[rgb]{ 1,  1,  1}{PROJECT SUPERVISION}} & \cellcolor[rgb]{ 0,  .125,  .376}5.3 Commissioning, completion &       &  \\
        \midrule
        \rowcolor[rgb]{ .949,  .949,  .949} \multirow{3}[6]{*}{\textcolor[rgb]{ 0,  .439,  .753}{\textbf{7}}} & \multicolumn{1}{l||}{\multirow{3}[6]{*}{\cellcolor[rgb]{ .4,  .6,  0}\textcolor[rgb]{ 1,  1,  1}{IN USE}}} & \multirow{3}[6]{*}{\textbf{9}} & \multicolumn{1}{l||}{\multirow{3}[6]{*}{\cellcolor[rgb]{ .4,  .6,  0}\textcolor[rgb]{ 1,  1,  1}{POST-COMPLETION SERVICES}}} & \cellcolor[rgb]{ .4,  .6,  0}6.1 Operation & \multirow{3}[6]{*}{\textcolor[rgb]{ .753,  0,  0}{\textbf{6}}} & \multicolumn{1}{r||}{\multirow{3}[6]{*}{\cellcolor[rgb]{ .4,  .6,  0}\textcolor[rgb]{ 1,  1,  1}{MANAGEMENT}}} \\
    \cmidrule{5-5}    \rowcolor[rgb]{ .949,  .949,  .949}       &       &       &       & \cellcolor[rgb]{ .4,  .6,  0}6.2 Supervision/ inspection / repair &       &  \\
    \cmidrule{5-5}    \rowcolor[rgb]{ .949,  .949,  .949}       &       &       &       & \cellcolor[rgb]{ .4,  .6,  0}6.3 Maintenance &       &  \\
        \bottomrule
        \bottomrule
        \end{tabular}%
      \label{tab:addlabel}%
    \end{table}%

\end{document}

enter image description here

enter image description here

daleif
  • 54,450
  • Horizontal lines from the booktabs package (\toprule, \bottomrule, \midrule and \cmidrule) are not compatible with vertical lines and don't work too well with colored cells. Instead of the first three, you can use \hline, instead of the last one, \cline. – leandriis Apr 07 '20 at 07:06
  • I also usggest that you define colors in the preamble of your document and use the predefined colors in your table. If you later on decide you want to change a color, you can easily alter the definition in the preamble and the whole table will adapt to that. This will also help keeping your code cleaner. – leandriis Apr 07 '20 at 07:11
  • Regrading the cellcolor in the multirows, take a look at https://tex.stackexchange.com/a/171785/134144 – leandriis Apr 07 '20 at 07:15
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Alessandro Cuttin Apr 07 '20 at 08:52
  • @AlessandroCuttin Sorry for the inconvenience. I am using so many packages in my thesis work, I don't which one exactly is being used for the table parts. – Faisel Moh'd Muktar Apr 08 '20 at 03:02
  • @leandriis thank you for the suggestion – Faisel Moh'd Muktar Apr 08 '20 at 03:03
  • @FaiselMoh'dMuktar just put the preamble so that we can work the way out to a MWE. If you provide the MWE we can propose to reopen the question – Alessandro Cuttin Apr 08 '20 at 10:41
  • @AlessandroCuttin....I have now included the preamble with all the package. I hope now it is complete. Or do I need to post it as a new question? – Faisel Moh'd Muktar Apr 09 '20 at 07:54
  • @FaiselMoh'dMuktar: Did you already try to incorporate some of my earlier suggestions into your code? Regarding the table being too wide, I suggest taking a look at the tabularx package. – leandriis Apr 09 '20 at 12:41

0 Answers0