I need to create a table like this:
- table with two columns and width equal to width of the page; border around whole table;
- first row spanning two columns; with background color, bold font and typeset as paragraph, with proper line wrapping of long text;
- second row with short label in first column, with additional left padding on the left; second column empty;
- a few rows listing some name-value pairs; item name in first column (same additional left padding as in label cell); item value in second column formatted as "xxx,xx zł" aligned to the right but with additional right padding;
- last row similar to the first, but without background color.
My best try so far does not handle first and last row properly, resulting in too wide rows. Is there some way to find the combined width of all columns and use it \multicolumn spec for those two rows?
Is there maybe some way to achieve this layout without using tabular environment?
\documentclass[10pt]{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabularx}{\textwidth}{ | X r | }
\hline
\rowcolor[gray]{0.6}
\multicolumn{2}{|>{\bfseries}p{\textwidth}|}{First row of the table - some long text in bold font with background color. This needs to wrap properly. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc venenatis nunc dui, sed pellentesque ante laoreet nec.}\\
\hspace{2mm}Label of the list: & \\
\hspace{2mm}first item of the list & 377,26 zl\hspace{2mm} \\
\hspace{2mm}second item of the list & 56,30 zl\hspace{2mm} \\
\hspace{2mm}last item of the list & 0,00 zl\hspace{2mm} \\
\multicolumn{2}{|>{\bfseries}p{\textwidth}|}{Last row of the table - some text in bold font}\\
\hline
\end{tabularx}
\end{document}