So, I've followed this example to highlight cells in my tabularx-table. This works well for single-"item"-cells and with some \hfill it works well enough for ragged-multiline-cells too.
However, with multiline, centering cells, this approach doesn't work at all, as the reference points are set by the first and last word thus drawing a frame cutting throught the text:
some playing around with newlines yields this result, which is ok, however the "full" line is not really nice:
So, how could I improve on this? I've tried to get the cell-extents (or at least \TX@col@width, but that didn't work for me); \hphantom should nominally do, what I want, but I think it doesn't really work in tables.
MWE (the newline/hfill-comments give the "ok" solution. :
\documentclass{standalone}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{tikz}
\usetikzlibrary{fit}
\usetikzlibrary{shapes}
\newcommand{\tabxmulticol}[3]
{\multicolumn{#1}
{>{\centering\hsize=\dimexpr#1\hsize+#1\tabcolsep+\arrayrulewidth\relax}#2}
{#3}}
\newcommand\marktopleft[1]{%
\tikz[overlay,remember picture]%
\coordinate (marker-#1-a) at (0,1.5ex) {};%
\hspace*{\fill}\newline%
}
\newcommand\markbottomright[1]{%
\newline \hspace*{\fill}
\pgfsetcornersarced{\pgfpoint{3mm}{3mm}}
\tikz[overlay,remember picture]
\coordinate (marker-#1-b) at (0,-0.5ex) {};%
\tikz[overlay,remember picture,thick,dashed,inner sep=0pt]
\node[draw,rectangle,fit=(marker-#1-a.center) (marker-#1-b.center)] {};%
}
\begin{document}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}
\begin{tabularx}{\textwidth}{p{0.24\textwidth}XX}
First row & & \marktopleft{cella} bla bla bla bla bla bla bla bla bla \markbottomright{cella} \
Second row & 2a & \
Third row & & 3b \
Fourth row & \tabxmulticol{2}{X}{\marktopleft{cellb} he he he he he he he he he he he he he he he he he he he he he he he he he he he he \markbottomright{cellb}} \
\end{tabularx}
\end{document}



