多行和 longtabu 长文本换行单元格高度调整不起作用

多行和 longtabu 长文本换行单元格高度调整不起作用

尝试在多行单元格中输入大量文本。当达到一定大小时,单元格不会扩展,而是继续在单元格边界外的下方。有什么办法可以解决这个问题吗?谢谢!

\documentclass{article}

%%%%%%%%%%%%%%%%%%%%%%
% Package Inclusions %
%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tabu}
\usepackage{longtable}
\usepackage{seqsplit}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{xparse}
\usepackage{array}
\usepackage{xstring}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{fancyhdr} %used for footers
\usepackage[absolute]{textpos}
\usepackage{lipsum}
\usepackage{lastpage}

%used to print Spanish characters in the text
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage[english,spanish]{babel}

%%%%%%%%%%%%%%%%%%%%%%
%   Configurations   %
%%%%%%%%%%%%%%%%%%%%%%

\geometry{
      top=0.50in,            
      inner=0.75in,
      outer=0.75in,
      bottom=0.50in,
      headheight=3ex,      
      headsep=6ex,          
    }

\setlength{\LTpre}{1pt} % removes the white space before a long table
\setlength{\LTpost}{1pt} % removes the white space after a long table
\newcommand{\wrapnum}[1]{\seqsplit{#1}}
\tabulinesep=1mm

\ExplSyntaxOn
    \NewDocumentCommand{\separator}{ }
     {
      \mode_if_math:TF { \allowbreak } { \- }
     }
    \NewDocumentCommand{\wrap}{ m }
     {
      \mathers_wrap:n { #1 }
     }

    \seq_new:N \l_mathers_input_seq
    \seq_new:N \l_mathers_output_seq
    \seq_new:N \l_mathers_temp_seq

    \cs_new_protected:Npn \mathers_wrap:n #1
     {
      \seq_clear:N \l_mathers_output_seq
      \seq_set_split:Nnn \l_mathers_input_seq { ~ } { #1 }
      \seq_map_inline:Nn \l_mathers_input_seq
       {
        \seq_set_split:Nnn \l_mathers_temp_seq { } { ##1 }
        \seq_put_right:Nx \l_mathers_output_seq
         { \seq_use:Nn \l_mathers_temp_seq { \separator } }
       }
      \seq_use:Nn \l_mathers_output_seq { ~ }
     }
\ExplSyntaxOff

%used to page break properly when using multirow and cline (hline wont work you must use cline)
\makeatletter
\def\@cline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height\arrayrulewidth\hfill
  \cr
  \noalign{\nobreak\vskip-\arrayrulewidth}}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Titles, Headers and Footers   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{Page \thepage\ of \pageref{LastPage}}
\fancyfoot[RE]{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

 % allow footer to be rotated during landscape mode
\fancypagestyle{lscape}{%
    \fancyhf{}
    \fancyfoot[RE]{
    \begin{textblock}{20}(1,5){\rotatebox{90}{}}\end{textblock}
    \begin{textblock}{1}(13,10.5){\rotatebox{90}{Page \thepage\ of \pageref{LastPage}}}\end{textblock}}
    \fancyfoot[RO] {
    \begin{textblock}{1}(19.75,3.5){\rotatebox{90}{Page \thepage\ of \pageref{LastPage}}}\end{textblock}
    \begin{textblock}{20}(1,13.25){\rotatebox{90}{}}\end{textblock}}

    \setlength{\TPHorizModule}{28pt}
    \setlength{\TPVertModule}{14pt}
    \renewcommand{\headrulewidth}{0.0pt}
    \renewcommand{\footrulewidth}{0.0pt}
    }

%%%%%%%%%%%%%%%%%%%%%%
% Start Report       %
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{landscape}
\thispagestyle{lscape}
\pagestyle{lscape}

\small

\begin{longtabu} to 9.5in {
    X[3,l,m]
    X[1,l,m]
    X[1,l,m]
}
    \Large\textbf{Report} &
    \Large\textbf{Job Number:} &
    \Large\textbf{32423432} 
\end{longtabu}

\begin{longtabu} to 9.5in {
    |X[1.5,l,m]|
    X[4,l,m]|
    X[2.5,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[2,l,m]|
    X[3,l,m]|
    X[2,l,m]|
    X[8,l,m]|
    }
    \hline

    \multicolumn{4}{|l|}{\textbf{Customer Name:}} &
    \multicolumn{5}{l|}{\textbf{Well Name:}} &
    \multicolumn{1}{l|}{\textbf{Job Date:}}

    \\

    \multicolumn{4}{|l|}{\parbox{3in}{\wrap{}}} &
    \multicolumn{5}{l|}{\parbox{4in}{\wrap{}}} &
    \multicolumn{1}{l|}{22/08/2014}


    \\\hline

    \multicolumn{4}{|l|}{\textbf{Customer Representative:}} &
    \multicolumn{3}{l|}{\textbf{County/Parish:}} &
    \multicolumn{2}{l|}{\textbf{State:}} &
    \multicolumn{1}{l|}{\textbf{Job Category:}}

    \\\cline{5-9}

    \multicolumn{4}{|l|}{\parbox{3in}{\wrap{Health}}} &
    \multicolumn{3}{c|}{\parbox{1.7in}{\centering\wrap{}}} &
    \multicolumn{2}{c|}{\parbox{1.9in}{\centering\wrap{}}} &
    \multicolumn{1}{l|}{\parbox{2.2in}{\wrap{}}}    

    \\\hline \hline

    \multicolumn{10}{|l|}{\cellcolor{blue!60}\large\textbf{}}

    \\\hline

    \textbf{CTU} &
    \multicolumn{2}{l|}{ 324234} &
    \multicolumn{2}{l|}{\textbf{CT Supervisor}} &
    \multicolumn{5}{l|}{ test test}

    \\\hline

    \textbf{MD} &
    \multicolumn{2}{l|}{ 324234} &
    \multicolumn{2}{l|}{\textbf{Casing Size In}} &
    \multicolumn{1}{l|}{32432}  &
    \multicolumn{1}{l|}{\textbf{Kick Off}}  &
    \multicolumn{1}{l|}{342}    &
    \multicolumn{1}{l|}{\textbf{30 deg}}    &
    \multicolumn{1}{l|}{32} 

    \\\hline

    \textbf{TVD} &
    \multicolumn{2}{l|}{ 324234} &
    \multicolumn{2}{l|}{\textbf{Casing Weight lb/ft}} &
    \multicolumn{1}{l|}{32432}  &
    \multicolumn{1}{l|}{\textbf{60 deg}}    &
    \multicolumn{1}{l|}{342}    &
    \multicolumn{1}{l|}{\textbf{90 deg}}    &
    \multicolumn{1}{l|}{32} 

    \\\hline

    \multicolumn{3}{|l|}{} &
    \multicolumn{2}{l|}{\textbf{Casing Cap bbl}} &
    \multicolumn{1}{l|}{32432}  &
    \multicolumn{1}{l|}{\textbf{CT Cap}}    &
    \multicolumn{1}{l|}{342}    &
    \multicolumn{1}{l|}{\textbf{CT AV}} &
    \multicolumn{1}{l|}{32} 

    \\\hline

    \multicolumn{2}{|l|}{\textbf{Min. ID In Well}} &    
    \multicolumn{3}{l|}{23423423423423} &
    \multicolumn{2}{l|}{\textbf{Restriction Type}} &
    \multicolumn{3}{l|}{The type} 

    \\\hline

    \multicolumn{10}{l}{}

    \\[-1ex]\hline

    \multicolumn{1}{|c|}{\multirow{3}{*}{\centering\textbf{Time}}} &
    \multicolumn{1}{c|} {\multirow{3}{*}{\centering\textbf{Activity Name}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Depth}}} &
    \multicolumn{2}{c|}{\centering\textbf{Pressure}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Weight}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Liquid Rate}}}&
    \multicolumn{1}{c|}{\multirow{2}{3cm}{\centering\textbf{Flow Black Rate / Liquid Type}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{N2 Rate}}}&
    \multicolumn{1}{c|}{\multirow{3}{*}{\centering\textbf{Activity Info}}} \\\cline{4-5}

    & & & 
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Circulation}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Wellhead}} &
    & & & & \\\cline{3-9}

    & &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Start/End}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(psi)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(psi)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(lbs)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(bbl/min)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(bbl)/Name}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(SCF/min)}} & 

    \\\hline \hline \hline \hline

    \endfirsthead

    \hline

    \multicolumn{4}{|l|}{\textbf{Customer Name:}} &
    \multicolumn{5}{l|}{\textbf{Well Name:}} &
    \multicolumn{1}{l|}{\textbf{Job Date:}}

    \\

    \multicolumn{4}{|l|}{\parbox{3in}{\wrap{Ecana}}} &
    \multicolumn{5}{l|}{\parbox{4in}{\wrap{Dromgoole A4H 8-28-14}}} &
    \multicolumn{1}{l|}{22/08/2014}


    \\\hline

    \multicolumn{4}{|l|}{\textbf{Customer Representative:}} &
    \multicolumn{3}{l|}{\textbf{County/Parish:}} &
    \multicolumn{2}{l|}{\textbf{State:}} &
    \multicolumn{1}{l|}{\textbf{Job Category:}}

    \\\cline{5-9}

    \multicolumn{4}{|l|}{\parbox{3in}{\wrap{Health}}} &
    \multicolumn{3}{c|}{\parbox{1.7in}{\centering\wrap{Jim Wells}}} &
    \multicolumn{2}{c|}{\parbox{1.9in}{\centering\wrap{Texas}}} &
    \multicolumn{1}{l|}{\parbox{2.2in}{\wrap{Wash Fill/Sand Removal}}}  

    \\\hline

    \multicolumn{10}{l}{}

    \\[-1ex]\hline

    \multicolumn{1}{|c|}{\multirow{3}{*}{\centering\textbf{Time}}} &
    \multicolumn{1}{c|} {\multirow{3}{*}{\centering\textbf{Activity Name}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Depth}}} &
    \multicolumn{2}{c|}{\centering\textbf{Pressure}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Tubing Weight}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{Liquid Rate}}}&
    \multicolumn{1}{c|}{\multirow{2}{3cm}{\centering\textbf{Flow Black Rate / Liquid Type}}} &
    \multicolumn{1}{c|}{\multirow{2}{1cm}{\centering\textbf{N2 Rate}}}&
    \multicolumn{1}{c|}{\multirow{3}{*}{\centering\textbf{Activity Info}}} \\\cline{4-5}

    & & & 
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Circulation}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Wellhead}} &
    & & & & \\\cline{3-9}

    & &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{Start/End}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(psi)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(psi)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(lbs)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(bbl/min)}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(bbl)/Name}} &
    \multicolumn{1}{c|}{\centering\scriptsize\textbf{(SCF/min)}} & 

    \\\hline \hline \hline \hline

    \endhead
    \multicolumn{3}{l}{Continued on next page ...} \\ 
    \endfoot
    \endlastfoot

    \multicolumn{1}{|c|}{\multirow{2}{*}{\centering{8:00}}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\parbox{27.4mm}{\centering\wrap{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr}}}} &
    \multicolumn{1}{c|}{\centering{60}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{86.9}}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{89.2}}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{210}}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{50}}} &
    \multicolumn{1}{c|}{\centering{289}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{1289}}} &
    \multicolumn{1}{c|}{\multirow{2}{*}{\centering{This is test info for the activity info}}} 

    \\* \cline{3-3}\cline{8-8}

    & &
    \multicolumn{1}{c|}{\centering{9:00}} &
    & & & &
    \multicolumn{1}{c|}{\centering{kj kjhf }} &
    &

    \\* \cline{1-10}

    &
    \centering{Comment} &
    \multicolumn{8}{l|}{kjrhe rh h h hher kjhkj rhje hjewrkjhe rkjher k} 

    \\\hline


\end{longtabu}

\end{landscape}
\end{document}

在此处输入图片描述

答案1

看起来我能够使用乳胶代码中嵌入的速度逻辑来解决这个问题。因为报告是动态的,我能够根据传入的给定文本计算需要添加多少额外的行。然后我会根据需要动态扩展单元格。有很多工作要做,但根据我在互联网上看到的内容,我没有看到任何其他解决方案。

相关内容