Saturday, March 24, 2012

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,
TPut 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" <TinaMSeaburn@.nospamexcite.comwrote in message
news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>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
>


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-mar@.nospam.nospamwrote in message
news:ulx$s1L5GHA.3452@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

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" <TinaMSeaburn@.nospamexcite.comwrote in message
news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>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
>>


>
>


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-mar@.nospam.nospamwrote in message
news:ulx$s1L5GHA.3452@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

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" <TinaMSeaburn@.nospamexcite.comwrote in message
news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>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
>>


>
>


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" <TinaMSeaburn@.nospamexcite.comwrote in message
news:OvyGZcO5GHA.3736@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

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-mar@.nospam.nospamwrote in message
news:ulx$s1L5GHA.3452@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>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" <TinaMSeaburn@.nospamexcite.comwrote in message
>news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>>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
>>>


>>
>>


>
>


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 (which will get messy). You could
read your text file and parse that file into <P>, <BR and where you
read line breaks and spaces.

"Tina" <TinaMSeaburn@.nospamexcite.comwrote in message
news:eqS$4fO5GHA.1248@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

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-mar@.nospam.nospamwrote in message
news:ulx$s1L5GHA.3452@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>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" <TinaMSeaburn@.nospamexcite.comwrote in message
>news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>>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
>>>


>>
>>


>
>


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:

Quote:

Originally Posted by

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-mar@.nospam.nospamwrote in message
news:ulx$s1L5GHA.3452@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

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" <TinaMSeaburn@.nospamexcite.comwrote in message
news:OLc94tL5GHA.3376@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>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
>


0 comments:

Post a Comment