trouble in displaying data

liunx

Guest
Hi everyone. <br />
I am an amateur html designer and I hava a big trouble about printing html pages. I retrieve data form data base and show it in html format. I show them in a table. I want the table to be fixed length in order to print it properly. But if any very long words exist in the data retrieven from the database the width of the data html page grows, does not fit to the print out page. All I wanna do is wrap the word automatically in order to fit it into the place where I want. Thanks all:P<!--content-->can we see your table code? :D<br />
<br />
I suggest you use CSS for having your table a fixed width<br />
<br />
Or not to use html for printing purposes and use a txt, doc, rtf, whateva<!--content-->table code is very simple <br />
<table width = 600> <br />
<tr><br />
<td><br />
jjsdjdskjdskdfsjhfkdjkfdjkfdjskfjdklsjfkldsjfkldsjfkldjkjjdklasjdksljdskljdksljdksaljdksljds<br />
</td><br />
</tr><br />
</table><br />
<br />
when the text inside the "td" tags is long width becomes more than 600. <br />
Could you please give some detail to use css as a solution.<br />
<br />
Thanks...<!--content-->hmm, it should work, try putting it like this <br />
width="600", but also include cellpadding="0" cellspacing="0" border="1"<br />
<br />
you dont have to put everything in "" but i think its not a bad habit of mine<!--content-->A table will wrap the data to a new line only at the first place a space occurs in the data. If there are no spaces in the data then the table cell will be stretched sideways to accomodate all of the full width of the data. To stop this happening you need to nest another table inside the table cell. Make the inner table a fixed width, and put the data inside that. There may be other ways to do this.<!--content-->thaks for your advise,<br />
after your advise I tried that implementation :<br />
<table><br />
<tr><br />
<td><br />
<table width="100"> <br />
<tr><br />
<td><br />
dskjaljdskladjksaljdksljdkslajdksladjskldjskldjsakld<br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
<br />
</table><br />
but did not work. Is anything wrong with the code or do I need another solution...<br />
Thanks.<!--content-->plain old HTML can't do the trick. you're going to have to use some sort of script to count characters and insert newlines or spaces or breaks or something. wish i could help you, but i don't know how to do it.<!--content-->you don't have a url do you?<!--content-->Try:<br />
<br />
<br />
<br />
<br />
<TABLE BORDER='1' BORDERCOLOR='#000000'><br />
<TR HEIGHT='20'><br />
<TD WIDTH='600'><br />
<br />
dskjaljdskladjksaljdksljdkslajdksladjskldjskldjsakld<br />
<br />
</TD><br />
</TR><br />
</TABLE><br />
<br />
<br />
<br />
EDIT: didn't read ur question properly :/<br />
<br />
I don't think there is a way to split up words in HTML, because if a word is to big, it will increase the width of the table.<!--content-->I want to add a last thing to the discussion,<br />
I dont have to use table in the page. any html based solution to show data in a fixed length place is ok for me.<br />
<br />
Thanks a lot...<br />
(unfortunetly I dont have url to show)<!--content-->the answer to this whol ethread is what giz said. you can't wrap a word that doesn't have any spaces in it. if you are getting them from a db then just split the word after so many characters.<br />
<br />
in php you can get the length of the string with strlen() but not sure what language you are using.<br />
<br />
so in short, it doesn't matter if you use tabled or not, it will not wrap the word if you don't have spaces.<br />
<br />
besides what word is that long, if none then you are getting what kind of info out of the db?<!--content-->
 
Back
Top