I have a table produced by the following code:

\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{rotating}

\begin{document}

\begin{table}[ht]

\begin{center}
\begin{tabularx}{\textwidth}{|l|X|l|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{
\begin{sideways}
Resident Engineer \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Pavement Engineer \,
\end{sideways}} &

\multicolumn{1}{c|}{
\begin{sideways}
Surveyor \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Environmental Specialist \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Materials Technicians \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Inspectors of Works \,
\end{sideways}} \\
\hline
Task 1  &   Mobilization and Project Inception & P  & P & P &  P    & P & P     \\
\hline
Task 2  &   Carry out data collection \& review of existing data  & P& S    & P &P  &P  & P\\
\hline
Task 3  &   Compiling and submitting the Inception report  &P   &   S&  &   &P  &       \\
\hline

\end{tabularx}
\end{center}

\end{table}

\end{document}


The problem is that Item and Task cells are not centered. How can I center the text in these two cells (vertical and horizontal alignment)?

-

Since you know the contents of the "longest" entries, you can use this to your advantage and raise the contents of the first two heading entries accordingly.

\documentclass[a4paper]{article}
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{graphicx}% http://ctan.org/pkg/graphicx

\begin{document}

\begin{table}[ht]
\begin{tabularx}{\textwidth}{|c|X|l|l|l|l|l|l|}
\hline
\rotatebox{90}{Resident Engineer} &
\rotatebox{90}{Pavement Engineer} &
\rotatebox{90}{Surveyor} &
\rotatebox{90}{Environmental Specialist\,} &
\rotatebox{90}{Materials Technicians} &
\rotatebox{90}{Inspectors of Works} \\
\hline
Task 1  &   Mobilization and Project Inception & P  & P & P &  P    & P & P     \\
\hline
Task 2  &   Carry out data collection \& review of existing data  & P& S    & P &P  &P  & P\\
\hline
Task 3  &   Compiling and submitting the Inception report  &P   &   S&  &   &P  &       \\
\hline
\end{tabularx}
\end{table}


The use of graphicx is sufficient to obtain rotated headings via \rotatebox{90}{<stuff>}. Also, using the center environment to centre a tabularx of width \textwidth is not necessary, since it fits to the text block width.

In the above example, the length \tabheadheight is used to capture the height of the "longest" entry. Subsequently, the first two headings are raised by .5\tabheadheight-.5\normalbaselineskip, setting them vertically centred.

-
Thanks a lot @Werner for the elegant solution and detailed explanation of how it works. I especially like the use of the graphicx package to obtain rotated headings, it is less cumbersome than what I used. –  engineervix Mar 25 '12 at 22:07

You can override the column alignment to center, and then raise the text by eye (or you could measure the longest heading)

\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{rotating}

\begin{document}

\begin{table}[ht]

\begin{center}
\begin{tabularx}{\textwidth}{|l|X|l|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\raisebox{4em}{Item}}  &
\multicolumn{1}{|c|}{
\begin{sideways}
Resident Engineer \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Pavement Engineer \,
\end{sideways}} &

\multicolumn{1}{c|}{
\begin{sideways}
Surveyor \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Environmental Specialist \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Materials Technicians \,
\end{sideways}} &
\multicolumn{1}{c|}{
\begin{sideways}
Inspectors of Works \,
\end{sideways}} \\
\hline
Task 1  &   Mobilization and Project Inception & P  & P & P &  P    & P & P     \\
\hline
Task 2  &   Carry out data collection \& review of existing data  & P& S    & P &P  &P  & P\\
\hline
Task 3  &   Compiling and submitting the Inception report  &P   &   S&  &   &P  &       \\
\hline

\end{tabularx}
\end{center}

\end{table}

\end{document}

-
Thanks @David Carlisle. This works well! –  engineervix Mar 25 '12 at 22:02