答案1
与。{NiceTabular}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{w{c}{5mm}cccc}[hvlines,corners=NW] % NW = north-west
& \;\diagbox{A}{B} & \Block{}{C \\ D} & \Block{}{ E \\ F} & \Block{}{ G \\ longer} \\
\Block{4-1}{H1} & I & text 1 & & text \\
& J & text 2 & & text \\
& K & text & & other text \\
& L & text & & text \\
\Block{4-1}{H2} & M & text & smth & text \\
& N & text & & text \\
& O & text & & text \\
& P & text text & & text \\
\end{NiceTabular}
\end{document}