Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...You have made an incredible site which is truly a great help to me in solving problems. A tip of my hat to you!..."

Geography

Where in the world do Tek-Tips members come from?

HTML Code for excel type fixed column display

tmk07 (IS/IT--Management)
29 Jun 12 0:31
I am having trouble to translate the csv format output into html format display. I used table/cell padding and even use non-printing char such " " but still unable to align heading column with the data column

Here is my problem
|Text-Column1 |Text-Column2 |Int-Column3|Float-Column4|
|data12345 |data32|45|0.0|
|datxc |fgtr56dfg4|56789|0.99887772|

Any solution to this problem will be highly appreciated
mrn (MIS)
29 Jun 12 10:04

CODE

awk -F"|" 'BEGIN {print "<table>"} ; {  print "<tr><td>" $1 "</td><td>" $2 "</td><td>" $3 "</td><td>" $4 "</td></tr>"} ; END { print "</table>"}' data.txt 

Produces

<table>
<tr><td></td><td>Text-Column1 </td><td>Text-Column2 </td><td>Int-Column3</td><td>Float-Column4</td><td></td></tr>
<tr><td></td><td>data12345 </td><td>data32</td><td>45</td><td>0.0</td><td></td></tr>
<tr><td></td><td>datxc </td><td>fgtr56dfg4</td><td>56789</td><td>0.99887772</td><td></td></tr>
</table>

from your data

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."

tmk07 (IS/IT--Management)
29 Jun 12 10:33
I have a similar code but problem is that the variable length data never fits into fixed length table cells. The table cell expand & shrink by the length of the data it contains. I want it like excel format where any length of data stays within the fixed length header colum
tmk07 (IS/IT--Management)
29 Jun 12 10:39

I don't see any way to copy screenshot here to provide detail on what I am looking for in terms of HTML table misalignment with the data

mrn (MIS)
29 Jun 12 11:13
So you want to truncate cells to say 8 chars or you want to expand cells to whatever the largest is?

Guessing this is the problem you have?

Text-Column1 Text-Column2 Int-Column3
data12345 data32 45
datxc fgtr56dfg4 56789
datxcfdfdfdfdfdfdfdf fddfdfdfdfdfdfdfgtr56dfg4 5575755757575756789

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."

tmk07 (IS/IT--Management)
29 Jun 12 11:54
Thanks MRN. You solved my problem. I was trying to align two different table cells together.
Much appreciated
Tmk

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close