Interestingly, I couldn't even use \rule in the lastfoot to add extra space. So I split it into two tabulars.
\documentclass[10pt, a4paper]{article}
\usepackage{longtable}
\pagestyle{empty}
\usepackage{showframe}
\begin{document}
\vspace*{17.4cm}
\begin{longtable}{@{}lc@{}}
Date & Grade
\endhead
2016-01-15 & C \
\phantom{\bfseries Summary:}
\endlastfoot
2016-01-01 & A\
2016-01-15 & B\
2016-01-01 & A\
2016-01-15 & B\
2016-01-01 & A\
\end{longtable}
\vfill
\noindent\hfil
\begin{tabular}[b]{@{}lc@{}}
\phantom{2016-01-15} & \phantom{Grade}\
\bfseries Summary:
\end{tabular}
\end{document}
It is possible to get all the column widths from the aux file instead of using \phantom. See here. By using two longtables one can share widths. The downside is that to shrink the widths one has to delete the old aux file.
\documentclass[10pt, a4paper]{article}
\usepackage{longtable}
\pagestyle{empty}
\usepackage{showframe}
\newlength{\LTwidth}
\newcommand{\LTwidthA}{0pt}
\newcommand{\LTwidthB}{0pt}
\makeatletter
\newcommand*{\getLTwidth}[1][0]% #1 = offet (optional): 0 = previous, 1 = next
{\bgroup% for \count1 and \LT@entry
\count1=#1\relax
\advance\count1 by \value{LT@tables}%
@ifundefined{LT@@roman{\count1}}{\LTwidth=\textwidth}{%
\dimen0=0pt%
\count2=0
\def\LT@entry##1##2{\advance\dimen0 by ##2\relax
\advance\count2 by 1
\expandafter\xdef\csname LTwidth@Alph{\count2}\endcsname{##2}}
\csname LT@@roman{\count1}\endcsname
}%
\global\LTwidth=\dimen0
\egroup}
\makeatother
\newcommand{\maxcell}[3]% #1 = width, #2 = l/r/c, #3 = text
{\bgroup
\dimen0=#1\relax
\sbox0{#3}%
\ifdim\wd0>\dimen0
\usebox0
\else
\makebox[\dimen0][#2]{\usebox0}%
\fi
\egroup}
\begin{document}
\vspace*{17.8cm}
\getLTwidth[2]% get widths from second table
\begin{longtable}{@{}lc@{}}
Date & Grade
\endhead
2016-01-15 & C
\endlastfoot
\maxcell{\dimexpr \LTwidthA-\tabcolsep}{l}{2016-01-01} &
\maxcell{\dimexpr \LTwidthB-\tabcolsep}{c}{A} \% any row will do
2016-01-15 & B\
2016-01-01 & A\
2016-01-15 & B\
2016-01-01 & A\
\end{longtable}
\getLTwidth% get widths from previous table
\vfill
\noindent\hfil
\begin{longtable}{@{}lc@{}}
%\rule{\LTwidthA}{1pt}\hspace{-\tabcolsep} & \hspace{-\tabcolsep}\rule[1pt]{\LTwidthB}{1pt} \
\maxcell{\dimexpr \LTwidthA-\tabcolsep}{l}{\bfseries Summary:} &
\maxcell{\dimexpr \LTwidthB-\tabcolsep}{c}{ }
\end{longtable}\unskip% remove gap at bottom
\end{document}
xltabular? I try to get a\hlineabove the summary, but it does not have the same width as my xltabular width. – Namal Feb 16 '22 at 08:41\begin{tabular}with\begin{tabularx}{\textwidth}{@{}lc@{}}in your example to get\hlineto the same length. Then it works! – Namal Feb 17 '22 at 06:54\maxcellis used in case the text inside turns out to be the widest entry (as is the case forSummary:). – John Kormylo Feb 17 '22 at 21:13