多行和多列

多行和多列

我想画一个一行有多列的表格,就像上传的图片那样。我有一个这种样式的普通表格的代码,我试图修改它,但失败了。上传的图片是word版表格的快照。我还想控制行和列之间的线宽,因为LaTex中的线宽稍宽。所以,它不是那么漂亮。顺便问一下,是否可以控制表格中文本的字体?你能帮点忙吗?非常感谢。

在此处输入图片描述

\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}

\begin{center}
\setlength{\arrayrulewidth}{2pt}
\setlength{\extrarowheight}{1pt}
\color{c1}
\arrayrulecolor{white}  

\begin{tabular}{|l|c|c|l|}

\rowcolor{c2}
\multirow{3}{*}{Measure} & \multicolumn{2}{|c|}{Description} & \multirow{3}{*}{NO.} \\
\hline

\rowcolor{c2}
{DFDF} & {fdsafdas} & {asdfasdf} & {asdfasd} \\
\hline

\rowcolor{c2}
{DFDF} & {fdsafdas} & {asdfasdf}  \\
\hline

\end{tabular}
\end{center}

答案1

正如 masu 提到的,在显示的图片中您没有多行。可能使用多行时您会在一个单元格中考虑更多行,如您从下面的示例中看到的那样:

\documentclass[border=5mm]{standalone}
    \usepackage[table]{xcolor}
\begin{document}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}
\setlength{\arrayrulewidth}{2pt}
\setlength{\extrarowheight}{1pt}
\arrayrulecolor{white}

    \begin{tabular}{|p{4em}|c|c|l|}
\rowcolor{c1}
\textcolor{white}{Measure} 
        & \multicolumn{2}{c|}{\textcolor{white}{Description}} 
                                        &   \textcolor{white}{NO.}  \\
    \hline
\rowcolor{c2}
DFDF    &   fdsafdas    &   asdfasdf    & {asdfasd}                 \\
    \hline
\rowcolor{c2}
DFDF DFDF   & fdsafdas  &   asdfasdf    &                           \\
    \hline
    \end{tabular}
\end{document}

答案2

可能是这样的:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array,multirow}

\begin{document}
\definecolor{c1}{rgb}{0.30980, 0.50588, 0.73725}
\definecolor{c2}{rgb}{0.82353, 0.87843, 0.92941}

\begin{center}
\setlength{\arrayrulewidth}{2pt}
\setlength{\extrarowheight}{1pt}
%% \renewcommand{\arraystretch}{3} %% can use this also
\color{c1}
\arrayrulecolor{white}

\begin{tabular}{|>{\rule{0pt}{2\baselineskip}}p{1.5cm}|
    >{\centering\arraybackslash}p{3cm}|
    >{\centering\arraybackslash}p{5cm}|
    p{1.5cm}|}

\rowcolor{blue}
\multicolumn{1}{|l|}{\textcolor{white}{Measure}} & \multicolumn{2}{l|}{\textcolor{white}{Description}} & \textcolor{white}{NO.} \\
\hline

\rowcolor{c2}
DFDF & fdsafdas & asdfasdf & asdfasd \\[\baselineskip]
\hline

\rowcolor{c2}
DFDF & \multicolumn{2}{p{\dimexpr2\tabcolsep+\arrayrulewidth+8cm\relax}|}{fdsafdas  asdfasdf this line is going to be long and occypy the second line possibly} & asdfasdf \\[2\baselineskip]
\hline

\end{tabular}
\end{center}
\end{document}

在此处输入图片描述

相关内容