Tabularray – Handling Automatic Wrapping After Merging Cells in Tabularray

tabularray

I want to merge the cells of the first row and the first column and the first row and the second column, and automatically wrap the cells after the merge


\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{tblr}{colspec={|Q[c,0.1\linewidth]|Q[l,0.4\linewidth]|Q[r,0.45\linewidth]|},rowspec={Q[c]Q[l]}}
        \hline
     \SetCell[c=2]{c}{This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.}   &  &DE  \\
    \hline
 ABC     &  ABC  &  ABC \\
    \hline
    \end{tblr}

\end{document}

Best Answer

You need hspan=minimal option:

\documentclass{article}
\usepackage{tabularray}
\begin{document}

\begin{tblr}{
  colspec={|Q[c,0.1\linewidth]|Q[l,0.4\linewidth]|Q[r,0.45\linewidth]|},
  rowspec={|Q[c]|Q[l]|},
  hspan=minimal,
}
  \SetCell[c=2]{l}{This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.} &       &  DE  \\
  ABC    &  ABC  &  ABC \\
\end{tblr}

\end{document}

enter image description here