[Tex/LaTex] Diagonal line for a table with multiple rows

cellfloatstables

Considering the answer of question, I used the slashbox package to draw a diagonal line. But the problem is I have multiple rows in my table and that makes the line not aligned well within the cell corners. It also gives wierd spaces between cells:

\documentclass{article}
\usepackage{slashbox}
\usepackage{adjustbox}

\begin{document}


\begin{table}[!htpc]
\begin{center}
  \centering
  \caption{some table.}
  \label{possibility}
  \begin{footnotesize}

   \adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
           max width=\textwidth}{
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}

  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
  &first  & first  & second  & second & both  & both  & &\\
  &key & key &  key &  key& key & key & none&all\\
\backslashbox{Room}{Date}  &at & at &  at &  at & at & at& & \\
   &d & p &  d & p & d & p & &\\ \hline
  $C_1$&Y & N & N & N & N & N & N &N \\ \hline

  \hline


\end{tabular}
}
\end{footnotesize}
\end{center}
\end{table}

\end{document} 

EDIT

I have used the answer presented by @bernard but it gives me ! Use of \line doesn't match its definition as an error. Not sure if it would happen for others as well.

Best Answer

It's better to use diagbox, which is more powerful. I improved your table using makecell (allows for line breaks and vertical padding in cells). Also, don't use the center environment in tables, as it adds unwanted vertical spacing; use \centering instead. The placement of the diagonal line is adjusted through the optional argument of \multirow.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{diagbox}
\usepackage{adjustbox}
\usepackage{caption, multirow, makecell}
\setcellgapes{3pt}

\begin{document}

\begin{table}[!htp]
  \centering
  \caption{some table.}
  \label{possibility}
  \footnotesize\makegapedcells
   \adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
   max width=\textwidth}{
  \begin{tabular}{|*{9}{c|}}
    \hline
    \multirowcell{5.2}[2.3ex]{\diagbox[height=5.17\line]{\rlap{\enspace\raisebox{2ex}{Room}}}{\raisebox{-3.5ex}{Date}}} &\makecell{first\\key} & \makecell{first\\key} & \makecell{second\\key} & \makecell{second\\key} & \makecell{both\\keys} & \makecell{both\\keys}& none&all\\
          & at & at & at & at & at & at & & \\
          & d & p & d & p & d & p & & \\ \hline
    $C₁$ & Y & N & N & N & N & N & N & N \\
    \hline
  \end{tabular}
  }
\end{table}

\end{document} 

enter image description here