Question on system.mail.net and formatting mail body

  • Thread starter Thread starter Scooby Dog
  • Start date Start date
S

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.
 
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.
 
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.
 
Dave,

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

You have to be more precise.

Cor
 
Dave,

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

You have to be more precise.

Cor
 
Scooby said:
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.
 
Scooby said:
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.
 
Scooby Dog wrote:
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
 
Scooby Dog wrote:
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
 
Back
Top