# How can i auto resize the column according to content

I use this code:

\begin{table}[H]
\caption{Offsets 2}
\centering
\begin{tabular}{*{6}{|c}}
\hline\hline
\rowcolor{orange}
student status  &  location type  & outside region & approved outside area (ha) & delivery agent\\ \hline \hline
Current         &  Restoration    & Northwest john Province & 476.0 &
If the position ... \\ \hline
\end{tabular}
\label{table:nonlin}
\end{table}


But the table is going outside the page. Is there any way that page don't go outside the page and shrink accoring to content and fit on page.

-
Could you please provide a MWE? A more readable indentation would be a huge help as well. – Betohaku May 3 '13 at 6:38

Yes, for example you can chenge

\begin{tabular}{*{6}{|c}}


onto

\begin{tabular}{*{6}{|p{2cm}}}


Of, course 2cm is only an example of width. This gives a paragraph, so entries are never (well, rarely) too long.

-
that was perfect , i got that. Is there any way to put the caption on the top of table and remove table 5 text from there – user17 May 3 '13 at 14:01
@user17 But the caption is over (on the top of) the table. Do you mean the same table, as in your question? – Przemysław Scherwentke May 3 '13 at 14:22