I have the following table layout:
The table consists of 3 columns - one column which is 25% wide, and two columns that take up equal amounts of the space left (thus 37.5% each).
The content for these columns is obtained from programmatic variables, which can vary in length quite a bit. Thus, each table cell should be able to process manual line breaks in the variable strings that get passed in, as well as automatic line breaks based on content length.
I've tried a couple different approaches, and the closest thing I've managed to a working example is included below, using multirow and nested tabular environments inside a tabularx for the width: MWE:
\documentclass[11pt,a4paper]{report}
\usepackage[margin=0.5cm]{geometry}
\usepackage{array,multirow,tabularx,lipsum}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{|p{4cm}|X|X|}
\hline
\multicolumn{1}{|l|}{
\begin{tabular}[l]{@{}l@{}}
One Line\\
Two Lines
\end{tabular}
} &
\multirow{3}{*}{
\begin{tabular}[l]{@{}l@{}}
Lots of text goes here\\
Lots of text here indeed lel lel lol aaa ss bzxbg
\end{tabular}
} &
\multirow{3}{*}{
\begin{tabular}[l]{@{}l@{}}
Lots of text go here\\
In fact, tons of text go here\\
So much text, in fact, that you'd have to do weird cell padding things to fix it\\
AAAA\\
BBBB\\
CCCC\\
DDDD\\
EEEE
\end{tabular}
} \\
\cline{1-1}
\begin{tabular}[l]{@{}c@{}}
This line here will overlap \\
AA
\end{tabular} & & \\
\cline{1-1}
\begin{tabular}[l]{@{}c@{}}
One Line\\
Two Lines\\
Three Lines
\end{tabular} & &
\\ \hline
\end{tabularx}
\end{document}
This layout has some issues, as can be seen below:
While the manual line breaks work, longer lines don't automatically break once they fill out the cells, instead overflowing on the side.
The two cells on the right also don't cause the multirow cells to resize, instead overflowing at the bottom. (the cells inside the multirow do cause a resize - if they are longer, the rightmost two cells do correctly resize downward)
The alignment + padding isn't 100% either.
Are there any simple mistakes one can easily fix in my MWE, or different approaches to multirow content that can dynamically resize? The usual answer is to match your multirow content to the number of lines in the largest cell. I can't do that here, as I do not know in advance which cell that will end up being, since the fields contain dynamic content.