[Tex/LaTex] Problem with framelines in tables

colorrulestables

I am having a problem with LaTeX at the moment, which I seem completely incapable of solving.
I am trying to create a simple table which has 4 columns and (should have in the end) 36 rows, including a header row. That header row, I want it to have a grey background.

Now, I have solved most of the issues concerning that topic, but in the end, my table refuses to put a vertical like between the 3rd and 4th header column – as long as it has the grey background color.
Before I tried to use the \cellcolor[...] option, and when I removed it for that 3rd and 4th cell, LaTeX would draw that vertical line.
So I tried with the \rowcolor[...] option, but the same thing. It's just either grey background or the missing vertical line.

I have tried two ways to draw that table, but the problem persists. Here is my example document, with two options that I tried to draw that table:

\documentclass[12pt,a4paper,toc=listofnumbered]{scrbook}
\usepackage[table]{xcolor}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\definecolor{dunkelgrau}{rgb}{0.8,0.8,0.8}

%First Option, but here is the upper left vertical line and the upper horizontal line missing
\begin{document}
\begin{table}[h]
\begin{tabular}{|c|c|c|c|}
\rowcolor{dunkelgrau}
\hline
\textbf{Proben-Nr.} & \textbf{Lokalität} & \textbf{Höhe in cm} & \textbf{Schliff-Nr.} \\
\hline
A & B & C & D  \\
\hline
A & B & C & D \\
\hline
\end{tabular}
\end{table}

%Second option, here the frame is entirely complete, just the missing vertical line between the 3rd and 4th header cell
\begin{tabular}{|c|c|c|c|}
\rowcolor{dunkelgrau}
\hline Proben-Nr. & Lokalität & Höhe in cm & Schliff-Nr. \\ 
\hline A & B & C & D \\ 
\hline A & B & C & D \\ 
\hline 
\end{tabular} 

\end{document}

Best Answer

Here's a different suggestion for a solution: Instead of trying to figure out which pdf viewer will (or will not) show which vertical and horizontal rules, you could create a table with no vertical rules and, yes, no horizontal rules either. Given the use of color (or, rather, gray) for the header row, there can be no confusion as to what's the header material and what's the body of the table. The "open" look that results from not using horizontal or vertical rules may be refreshing. Give it a try.

enter image description here

\documentclass[12pt,a4paper,toc=listofnumbered]{scrbook}

\usepackage[table]{xcolor}
\definecolor{dunkelgrau}{rgb}{0.8,0.8,0.8}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\begin{document}

\begin{table}[h]
\centering

\begin{tabular}{cccc}
\rowcolor{dunkelgrau}
\textbf{Proben-Nr.} & \textbf{Lokalität} & \textbf{Höhe in cm} & \textbf{Schliff-Nr.} \\
A & B & C & D  \\
A & B & C & D \\
\end{tabular}

\bigskip
\begin{tabular}{cccc}
\rowcolor{dunkelgrau}
Proben-Nr. & Lokalität & Höhe in cm & Schliff-Nr. \\ 
 A & B & C & D \\ 
 A & B & C & D \\  
\end{tabular} 
\end{table}
\end{document}