473,666 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display non-HTML line breaks

G'day everyone

I'm trying to find out if there is a way (perhaps using CSS) to let
this code:

<table><tr><td> One
Two
Three</td></tr></table>

display the same as if the code would have been:

<table><tr><td> One<br>
Two<br>
Three</td></tr></table>

Of course, once I figure out how to do this, I still have to see if my
wysiwig HTML viewer can display it :-) because my wysiwig HTML viewer
is MS Word and/or OOo Writer. The reason is that I'm trying to use
HTML as an intermediary format to convert CSV to a word processing
format. But let me worry about that... it would be great if any of
you could just help me with the problem described above.

Thanks in advance
Samuel (aka leuce) ltns
Sep 3 '08 #1
19 2333
On 2008-09-03, Samuel Murray <le***@absamail .co.zawrote:
G'day everyone

I'm trying to find out if there is a way (perhaps using CSS) to let
this code:

<table><tr><td >One
Two
Three</td></tr></table>

display the same as if the code would have been:

<table><tr><td >One<br>
Two<br>
Three</td></tr></table>
td { white-space: pre-wrap }

or just white-space: pre (not all browsers support all the more exotic
flavours of white-space).
Sep 3 '08 #2
Samuel Murray wrote:
I'm trying to find out if there is a way (perhaps using CSS) to let
this code:

<table><tr><td> One
Two
Three</td></tr></table>

display the same as if the code would have been:

<table><tr><td> One<br>
Two<br>
Three</td></tr></table>

Of course, once I figure out how to do this, I still have to see if my
wysiwig HTML viewer can display it :-) because my wysiwig HTML viewer
is MS Word and/or OOo Writer. The reason is that I'm trying to use
HTML as an intermediary format to convert CSV to a word processing
format. But let me worry about that... it would be great if any of
you could just help me with the problem described above.
<table><tr><td> <pre>One
Two
Three
1
2
3</pre></td></tr></table>

--
Nico

Sep 3 '08 #3
On Sep 3, 9:06*am, Ben C <spams...@spam. eggswrote:
On 2008-09-03, Samuel Murray <le...@absamail .co.zawrote:
I'm trying to find out if there is a way (perhaps using CSS) to let
this code:
td { white-space: pre-wrap }

or just white-space: pre (not all browsers support all the more exotic
flavours of white-space).
Thanks, this really helps.

Incidently, MS Word XP understands pre but not pre-wrap. OOo Writer
2.4 does not understand either of them.

Samuel (leuce)
Sep 3 '08 #4
Samuel Murray wrote:
G'day everyone

I'm trying to find out if there is a way (perhaps using CSS) to let
this code:

<table><tr><td> One
Two
Three</td></tr></table>

display the same as if the code would have been:

<table><tr><td> One<br>
Two<br>
Three</td></tr></table>

Of course, once I figure out how to do this, I still have to see if my
wysiwig HTML viewer can display it :-) because my wysiwig HTML viewer
is MS Word and/or OOo Writer. The reason is that I'm trying to use
HTML as an intermediary format to convert CSV to a word processing
format. But let me worry about that... it would be great if any of
you could just help me with the problem described above.
I'm confused and curious. Are you only using Word to view HTML or are
you using it to edit/write HTML as well? If the latter, that's just a
terrible idea. I don't know about Open Office but Word generates
hideous HTML.

As for CSV conversion, what's the problem? I can open a .csv file in
Word 2000 directly: It's plain text. Highlight the csv data, click
Table, Convert, Text to Table. Voila.

--
Ed Mullen
http://edmullen.net
A conscience is what hurts when all your other parts feel so good.
Sep 3 '08 #5
Neredbojias wrote:
On 02 Sep 2008, Samuel Murray <le***@absamail .co.zawrote:
>I'm trying to find out if there is a way (perhaps using CSS) to let
this code:

<table><tr><td >One
Two
Three</td></tr></table>

display the same as if the code would have been:

<table><tr><td >One<br>
Two<br>
Three</td></tr></table>

Look into the html <preattribute .
<PREisn't an attribute; it's an element.

A <PREblock inside the <TDis not the same as inserting <BR>
elements. Some elements which may be children of <TDmay not be
children of <PRE>. User agents may, and often do, apply formatting
rules to text within a <PREblock that they don't apply (under the
default styles) to text within <TD>, such as using a monospaced typeface.

In short, this suggestion doesn't do what the OP asked for. Whether it
does what the OP *wants* is another question; and the OP might have
some success using <PREplus additional styling to render the text in
a more appropriate manner. (That assumes he doesn't need any of the
elements that <PREexcludes, such as <IMG>, inline in his <TD>s.)

If Ben's suggestion of "white-space: pre-wrap" won't work, for
example, something like the following might provide the basic feature
with better styling under capable user agents and graceful degredation
under others:

td pre {
font-family: inherit;
white-space: pre-line;
}

<table>
<tr><td><pre>
One
Two
Three
</pre></td></tr>
</table>

"pre-line" seems to me closer to the OP's original request than Ben's
suggestion of "pre-wrap", since the former collapses whitespace.

Obviously the font styling might have to be changed, depending on how
<TDis styled. "font-family: inherit" works with FF2, but not with
IE7, so "font-family: serif" (or whatever) might be a better choice.

Unfortunately, none of the UAs I tried (FF2, IE7, oOO Writer 2.4)
appear to actually support "white-space: pre-line", so to get this to
render the way I think the OP wants it, you'd have to get rid of the
extra whitespace inside the <PREblock.

But this combination does preserve the line breaks and it does degrade
gracefully; in particular, oOO Writer will preserve the line breaks,
which I gather the OP wanted. And the line breaks will be preserved
even if CSS is disabled or overridden, which is probably desirable.

--
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University
Sep 3 '08 #6
On 2008-09-03, Michael Wojcik <mw*****@newsgu y.comwrote:
[...]
"pre-line" seems to me closer to the OP's original request than Ben's
suggestion of "pre-wrap", since the former collapses whitespace.
Yes, you're right pre-line is better (or would be if more people
supported it).

Pre-line is the same as normal except that it doesn't collapse newlines,
which is exactly what the OP wants.
Sep 3 '08 #7

Michael Wojcik wrote:
>
In short, this suggestion doesn't do what the OP asked for. Whether it
does what the OP *wants* is another question;
It may actually be more a case of deciding on a solution without fully
defining the problem. We don't know the whole situation, just that the
OP has asked how to do these line breaks. It could be doing something
else altogether is a better solution.

--
Berg
Sep 3 '08 #8

Ed Mullen wrote:
Samuel Murray wrote:
>>
I'm trying to use
HTML as an intermediary format to convert CSV to a word processing
format. But let me worry about that...

I'm confused and curious.
Me, too.
As for CSV conversion, what's the problem? I can open a .csv file in
Word 2000 directly
Why the OP wants to use HTML for this is a bit baffling.

--
Berg
Sep 3 '08 #9
Bergamot wrote:
Ed Mullen wrote:
>Samuel Murray wrote:
>>I'm trying to use
HTML as an intermediary format to convert CSV to a word processing
format. But let me worry about that...
I'm confused and curious.

Me, too.
>As for CSV conversion, what's the problem? I can open a .csv file in
Word 2000 directly

Why the OP wants to use HTML for this is a bit baffling.
Well, I'm glad it isn't just me.

--
Ed Mullen
http://edmullen.net
Are there seeing eye humans for blind dogs?
Sep 3 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3077
by: SB | last post by:
Hi, I'd like to display some non-ascii characters in a DOS window. I'm getting the characters from Windows Character Map, such as the Spade (U+2660) and a few others. However, I can't get it to work. I know the characters I'm trying to display are Unicode and that is presenting the problem. Does anyone know how to do this if even possible? Thanks!
4
2232
by: bissatch | last post by:
I am trying to use DIV tags and a class to hide the DIV and the HTML within. I will use JavScript to change it from hidden to visible but that will come later. Below is the code I am using <div class="hide"> <tr> <td nowrap>Name:</td> <td nowrap>Monty</td>
15
3427
by: yxq | last post by:
Hi I want to detect user display type, LCD or CRT, how to do? Thanks
5
2180
by: yma | last post by:
Hello, I tried to display a column in MS Access 2000 nwind.mdb using 3 data controls. But I got "It is already opened exclusively by another user, or you need permission to view its data." I put ole DataAdapter, Connection and dataset controls and fill in the properties of the listbox. The only code I have is OleDbDataAdapter1.Fill(DataSet11, "employees") in page_load sub.
13
3649
by: Ennio-Sr | last post by:
Hi all! After a very long struggle I finally succeded in transferring my old *.dbf file and the relating *.dbt (alias memo fields) to a pg table. For the time being I put the memo field in a separate table having two fields only (i.e.: n_memo integer, memo text) which can be related to the main table in a view.
1
1531
by: DavidADEW | last post by:
I am writing an application that displays furniture in a 3D model - in a wire frame. The furniture has straight and rounded edges (doesn't need any shading) - a kind of CAD application but for non CAD users and restricted functionality. The display on screen must be in 3D, and rotate / zoom in. I am looking for a library / component that will display the 3D graphics - and allow me to print out. I don't have to place objects on the 3D...
3
2244
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr + "&ChartType=" + drpChartType.SelectedItem.Value.ToLower() + "&Print=" + printVersion.ToString() ... Catch e As Exception
1
2392
by: sneeka2 | last post by:
Hi, I'm developing a portfolio site, which contains a bunch of thumbnails wrapped in links: <a href="..."><img ... /></a>. A window.onload script inserts an onclick property into the links which changes their behaviour to load the big image in a <div> on the same page, instead of going to another site. For that purpose I have a <div><img ... /></div> construct in the page which is set to a fixed height and width and 'display: none' via CSS....
11
7612
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I know I sound like a one-note Johnny on this but I'm still looking for a solution. I need to display characters coming in from a serial port or a socket. I also need to be able to type characters into the display myself - but that's not the main issue at this time. I've tried a scrolling multiline text box but once the original viewable area fills up and it starts scrolling the flashing of the entire area drives me nuts. The...
1
1684
by: Wingot | last post by:
Hey, I have an application codenamed WingFlex. It has a number of aspects to it, but the prudent parts for this problem are all within the "Client" Schema. The Client schema has three tables in it, on named Country, one named MedicalCondition, and one named Customer. The Customer database has five foreign keys in it, one to Country, one to MedicalCondition, and three as self referential keys to Customer (BillTo, for where the
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.