# Generate box with content in header

Halo everyone, I intend to create the one as shown in the attached photo as the header of my document using TeX but I can't seem to get it right. Either my box are distorted or they can't be balance on the same line like the one shown in the attached photo. Can anyone show me the correct way if possible in doing this in tex? Flush left and right seem not working to me but being a newbie I can't certain about that.

Following recommendations by Werner, I successfully produce what I am looking for but now the right hand column first row's height got change.

See here:

with my code as shown here:

\begin{tabular}{|p{2cm}|*{7}{p{5mm}|}}
\hline
\rule{0pt}{1.5em}R.\ No & & & & & & & \\
\hline
\end{tabular}%
}}
\begin{tabular}{|*{5}{>{\centering\arraybackslash}p{5mm}|}}
\hline
1 & 2 & 3 & 4 & \phantom{5} \\ \hline
&   &   &   & \\
\hline
\end{tabular}%
}}
}

So is there any mistake that I had done above?

-
It would be helpful if you posted a full compilable example showing what you have done so far. –  Peter Grill Oct 4 '12 at 17:25
@PeterGrill, mine is not successful. I did the above using Paint and move around the picture so that it looks like what I want. –  Sandra Oct 4 '12 at 17:49

Here is something you can work with, that uses fancyhdr to set the header of the page.

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{fancyhdr}% http://ctan.org/pkg/fanychdr
\hline
R.\ No & & & & & & & \\
\hline
\end{tabular}%
}
\hline
1 & 2 & 3 & 4 & \phantom{5} \\ \hline
&   &   &   & \\
\hline
\end{tabular}%
}
\renewcommand{\footrulewidth}{0pt}% No footer rule
}
\begin{document}
\lipsum
\end{document}​

geometry is used to easily modify the page layout, adding the required headheight change to accommodate a double-line tabular in the header. lipsum just provides dummy text.

The MWE above provides a myheader page style which you can set for only one page (using \thispagestyle{myheader}) or globally (as is currently done, via \pagestyle{myheader}). You didn't mention anything about a footer, but that can be added to the myheader page style. For example, adding the page number and/or a rule.

To increase the line width for the header tabulars, include the length setting of \arrayrulewidth in a group inside the respective headers. Also the cell widths can be modified by specifying something like p{5mm}, while the height is adjustable via the inclusion of a vertical "strut" using \rule{0pt}{<height>}:

\usepackage{array}% http://ctan.org/pkg/array
\newcommand{\clap}[1]{\makebox[0pt]{#1}}% Centered zero-width box
%...
\begin{tabular}{|p{2cm}|*{7}{c|}}
\hline
\rule{0pt}{1.5em}R.\ No & & & & & & & \\
\hline
\end{tabular}%
}}
\begin{tabular}{|*{5}{>{\centering\arraybackslash}p{5mm}|}}
\hline
\rule{0pt}{1.5em}\clap{1} & \clap{2} & \clap{3} & \clap{4} & \\ \hline
\rule{0pt}{1.5em}  &   &   &   & \\
\hline
\end{tabular}%
}}