473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Text to HTML

I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same in
source view. If I put it into MS Word and save as plain html it puts all
sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T
Sep 30 '06 #1
6 1385
Put the text into a <PRE>...</PREtag, which will hold on to the whitespace
formatting. You can put the PRE tag into a DIV tag if you want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T

Sep 30 '06 #2
Well, that works pretty good. Thanks.
Is there a way to get the text to wrap inside the PRE or the DIV?
Thanks,
T

"Scott M." <s-***@nospam.nospamwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
Put the text into a <PRE>...</PREtag, which will hold on to the
whitespace formatting. You can put the PRE tag into a DIV tag if you
want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T


Sep 30 '06 #3
Oh, I also notice that text inside the PRE will not follow CSS specified
fonts so it looks like
it acts just like text in a text box and these are the reasons I did not
want to use a textbox.
T

"Scott M." <s-***@nospam.nospamwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
Put the text into a <PRE>...</PREtag, which will hold on to the
whitespace formatting. You can put the PRE tag into a DIV tag if you
want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T


Sep 30 '06 #4
Sorry, you can't have it both ways. Use PRE and WYSIWYG, no more and no
less - don't use PRE and all white space is stripped.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:Ov**************@TK2MSFTNGP02.phx.gbl...
Well, that works pretty good. Thanks.
Is there a way to get the text to wrap inside the PRE or the DIV?
Thanks,
T

"Scott M." <s-***@nospam.nospamwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
>Put the text into a <PRE>...</PREtag, which will hold on to the
whitespace formatting. You can put the PRE tag into a DIV tag if you
want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>>>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T



Oct 1 '06 #5
Again, that's what PRE does - uses a monospaced font.

You've got to remember the language you are working in. HTML is a language
where whitespace stripping occurs. If you want to build space back in, you
could look into entities such as &nbsp; (which will get messy). You could
read your text file and parse that file into <P>, <BR and &nbsp; where you
read line breaks and spaces.

"Tina" <Ti**********@nospamexcite.comwrote in message
news:eq**************@TK2MSFTNGP03.phx.gbl...
Oh, I also notice that text inside the PRE will not follow CSS specified
fonts so it looks like
it acts just like text in a text box and these are the reasons I did not
want to use a textbox.
T

"Scott M." <s-***@nospam.nospamwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
>Put the text into a <PRE>...</PREtag, which will hold on to the
whitespace formatting. You can put the PRE tag into a DIV tag if you
want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>>>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T



Oct 1 '06 #6
PRE
{
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}

Tina wrote:
Well, that works pretty good. Thanks.
Is there a way to get the text to wrap inside the PRE or the DIV?
Thanks,
T

"Scott M." <s-***@nospam.nospamwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
Put the text into a <PRE>...</PREtag, which will hold on to the
whitespace formatting. You can put the PRE tag into a DIV tag if you
want.
"Tina" <Ti**********@nospamexcite.comwrote in message
news:OL**************@TK2MSFTNGP05.phx.gbl...
>I have a text file perfectly formatted with carriage returns, indents,
spacing etc in NotePad. I want to put text that looks exactly like that
into a <divand get it formatted exactly the same way in Visual Studio.
But I can't seem to get this done in Visual Studio other than pasting it
into a textbox - which I don't want to do.

If I paste it into a div in design view it removes all formatting. Same
in source view. If I put it into MS Word and save as plain html it puts
all sorts of gargage in it that doesn't work in VS.

Is there any program that will do this?

Thanks,
T
Oct 1 '06 #7

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

Similar topics

2
by: Nebojsa Topolscak | last post by:
Hello, I wrote application which doesn't use graphic at all. One part of application needs Parser class from javax.swing.text.html.HTMLEditorKit. The ridiculous fact is when I try to...
9
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
6
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> ...
4
by: Pete Forman | last post by:
Ian Hickson's essay at http://www.hixie.ch/advocacy/xhtml and many others argue that XHTML served as text/html should be considered harmful. I'm looking for any evidence that this is really so. ...
0
by: | last post by:
Hello NG! I try to call a WebService from a mobile device. The WebService should return a DataSet, so the call looks like mDataSet = mWebSrv.GetDataSet(<Params>) but instead of returning a...
4
by: Mark | last post by:
I have written a PocketPC application that connects to a web service, and when im connected via the cable or via wireless then it pulls back the data correctly. However when connected to GPRS, i...
13
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
9
by: ismailc | last post by:
Hi, I need help please I usually code in coldfusion but now i want to create 2 text html files where i pass a parameter on href? This normally works in coldfusion! Page1 <a...
14
by: Stanimir Stamenkov | last post by:
I've found some contradiction I want to resolve. <http://www.w3.org/MarkUp/2004/xhtml-faq#mime11states: I've noted "_disallowed_ text/html" and "_must_ be sent with an XML-related media...
2
by: doubts85 | last post by:
i have problem when i try build this application and the error is below. Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.