无法同时使用 multirow 和 multicol

无法同时使用 multirow 和 multicol

我不能使用多行多列,我在下面代码中的目的是要有一个两行高度的行,内容长标题垂直居中两行,我在这里遗漏了什么?

\begin{table*}
\centering 
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{tabularx}{\linewidth}{|l|C|C|C|C|C|C|}
\hline
\bf{} & \multirow{2}{*}{\bf{Value}} & \multirow{2}{*}{\bf{Value}} & \bf{Some Value} & \bf{ome Value} & \multirow{2}{*}{\bf{ome Value}} & \multirow{2}{*}{\bf{Value}}
\\ \hline
\multicolumn{7}{|c|}{\multirow{2}{*}{A long header vertically centered in two rows}}
\\ \hline
\bf{Row header} & 12.34 & 12.34 & 12.34 & 12.34 & 12.34 & 12.34
\\ \hline
\end{tabularx} 
\caption{Table results}
\label{results} 
\end{table*} 

答案1

你应该读一下它是如何multirow工作的

\begin{table*}
\centering 
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{tabularx}{\linewidth}{|l|C|C|C|C|C|C|}
\hline
\textbf{} & \multirow{2}{*}{\textbf{Value}} & \multirow{2}{*}{\textbf{Value}} & \textbf{Some Value} & \textbf{ome Value} & \multirow{2}{*}{\textbf{ome Value}} & \multirow{2}{*}{\textbf{Value}}
\\ \hline
\multicolumn{7}{|c|}{\multirow{2}{*}{A long header vertically centered in two rows}}
\\ \multicolumn{7}{|c|}{} % add
\\ \hline
\textbf{Row header} & 12.34 & 12.34 & 12.34 & 12.34 & 12.34 & 12.34
\\ \hline
\end{tabularx} 
\caption{Table results}
\label{results} 
\end{table*} 

相关内容