Home All Groups Group Topic Archive Search About

Question on system.mail.net and formatting mail body

Author
22 May 2009 7:50 PM
Scooby Dog
Could someone help:

    I am working on a small vb.net app that will read a text file line by
line ( it's actuall a text file that has been formatted via a Cobol app )
and then build a stringbuilder object via .append.  My problem is when I do
mail.body = str.Tostring the formatting is all screwed up.  I have tested
just pasting the text into an outlook email and changing the font of the
text to  Curriour New and it aligns and send/looks great.  Is there a way to
do that in code other then spending hours formatting the text using html.


Thanks


Dave.

Author
23 May 2009 1:50 AM
James Hahn
You haven't indicated what you mean by 'all screwed up', but if you can fix
your formatting problem just by changing the font to Courier New then the
formatting problem is that the lines are not displaying as the same length
even though they contain the same number of characters.  In that case you
already have the solution - use a fixed-width font to display the text.

If there is some other formatting problem then you need to describe what's
actually happening and what you want to happen.

Show quoteHide quote
"Scooby Dog" <duckkille***@somenet.net> wrote in message
news:7EC94292-D3F3-458A-A082-35D7DE4E684E@microsoft.com...
> Could someone help:
>
>    I am working on a small vb.net app that will read a text file line by
> line ( it's actuall a text file that has been formatted via a Cobol app )
> and then build a stringbuilder object via .append.  My problem is when I
> do mail.body = str.Tostring the formatting is all screwed up.  I have
> tested just pasting the text into an outlook email and changing the font
> of the text to  Curriour New and it aligns and send/looks great.  Is there
> a way to do that in code other then spending hours formatting the text
> using html.
>
>
> Thanks
>
>
> Dave.
Author
23 May 2009 3:22 AM
Cor Ligthert[MVP]
Dave,

That it is formatted via a Cobol app says absolute nothing.

You have to be more precise.

Cor

Show quoteHide quote
"Scooby Dog" <duckkille***@somenet.net> wrote in message
news:7EC94292-D3F3-458A-A082-35D7DE4E684E@microsoft.com...
> Could someone help:
>
>    I am working on a small vb.net app that will read a text file line by
> line ( it's actuall a text file that has been formatted via a Cobol app )
> and then build a stringbuilder object via .append.  My problem is when I
> do mail.body = str.Tostring the formatting is all screwed up.  I have
> tested just pasting the text into an outlook email and changing the font
> of the text to  Curriour New and it aligns and send/looks great.  Is there
> a way to do that in code other then spending hours formatting the text
> using html.
>
>
> Thanks
>
>
> Dave.
Author
27 May 2009 11:29 AM
Phill W.
Scooby Dog wrote:

> I am working on a small vb.net app that will read a text file line by
> line (it's actually a text file that has been formatted via a Cobol app)
> and then build a stringbuilder object via .append. 

When appending to your StringBuilder, are you /replacing/ the
line-breaks that ReadLine() will /remove/ on your behalf?  It only gives
you the text of each line, assuming that you don't actually want the
line-breaks themselves.

Also; if all you're doing is reading the file line-by-line and calling
[[StringBuilder]].Append() for every one, why not just read the whole
file in one go?

Dim fs as new FileStream( "file", ... )
Dim sr as new StreamReader( fs )
sr.ReadToEnd() ' gets /everything/; line-breaks and all
sr.Close()

> My problem is when I do mail.body = str.Tostring the formatting is all
> screwed up.  I have  tested just pasting the text into an outlook email
> and changing the font  of the text to Courier New and it aligns and
> send/looks great. 

Definitely sounds like you're losing something in translation.

HTH,
    Phill  W.
Author
27 May 2009 3:51 PM
Andrew Morton
Scooby Dog wrote:
<re: formatting text in an email>
> Is there a way to do that in code other then spending hours formatting the
> text using html.

No. Unless it takes you minutes rather than hours :-)

Andrew