469,266 Members | 2,023 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,266 developers. It's quick & easy.

line feed and tab

I have a C# app that I am writing which is going to insert text into a
table, which is then picked up by another program and emailed. On the text
version of the email (when the user doesn't have html email), I need to put
tabs in between columns of data and then line feeds after each row. How can
I do this? Right now I'm doing "\t" for tab and "\r\n" for line feed, but
when I generate the text, those characters actually come out in the text.

Please help.
Mark
Nov 13 '05 #1
5 67738
Mark,

Instead of escape sequences you could also use explicit type casting.
To insert a horizontal tab, you would then simply use (char) 9

Hope this helps.

Regards,
Alex

"Mark" <ma*****@kc.rr.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
I have a C# app that I am writing which is going to insert text into a
table, which is then picked up by another program and emailed. On the text version of the email (when the user doesn't have html email), I need to put tabs in between columns of data and then line feeds after each row. How can I do this? Right now I'm doing "\t" for tab and "\r\n" for line feed, but
when I generate the text, those characters actually come out in the text.

Please help.
Mark

Nov 13 '05 #2
I tried this and it still comes out with the "\t" in the string.

"Alex Bendig" <a.******@ieee.org> wrote in message
news:be**********@newsserver.rrzn.uni-hannover.de...
Mark,

Instead of escape sequences you could also use explicit type casting.
To insert a horizontal tab, you would then simply use (char) 9

Hope this helps.

Regards,
Alex

"Mark" <ma*****@kc.rr.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
I have a C# app that I am writing which is going to insert text into a
table, which is then picked up by another program and emailed. On the

text
version of the email (when the user doesn't have html email), I need to

put
tabs in between columns of data and then line feeds after each row. How

can
I do this? Right now I'm doing "\t" for tab and "\r\n" for line feed, but when I generate the text, those characters actually come out in the text.
Please help.
Mark


Nov 13 '05 #3
Could you show some code for the portion where you generate your text
version of the email? One way could certainly be to substitute the verbatim
escape sequences with the appropriate formatting characters.

"Mark" <ma*****@kc.rr.com> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
I tried this and it still comes out with the "\t" in the string.

"Alex Bendig" <a.******@ieee.org> wrote in message
news:be**********@newsserver.rrzn.uni-hannover.de...
Mark,

Instead of escape sequences you could also use explicit type casting.
To insert a horizontal tab, you would then simply use (char) 9

Hope this helps.

Regards,
Alex

"Mark" <ma*****@kc.rr.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
I have a C# app that I am writing which is going to insert text into a
table, which is then picked up by another program and emailed. On the

text
version of the email (when the user doesn't have html email), I need
to
put
tabs in between columns of data and then line feeds after each row.
How can
I do this? Right now I'm doing "\t" for tab and "\r\n" for line feed,

but when I generate the text, those characters actually come out in the text.
Please help.
Mark



Nov 13 '05 #4
Okay, I've tried it both of these ways and get the same result.

string strText="Property Name" + (char)9 + "Address" + (char)9 +
"City/State/Zip";
OR
string strText="Property Name" + "\t" + "Address" + "\t" + "City/State/Zip";

"Alex Bendig" <a.******@ieee.org> wrote in message
news:be**********@newsserver.rrzn.uni-hannover.de...
Could you show some code for the portion where you generate your text
version of the email? One way could certainly be to substitute the verbatim escape sequences with the appropriate formatting characters.

"Mark" <ma*****@kc.rr.com> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
I tried this and it still comes out with the "\t" in the string.

"Alex Bendig" <a.******@ieee.org> wrote in message
news:be**********@newsserver.rrzn.uni-hannover.de...
Mark,

Instead of escape sequences you could also use explicit type casting.
To insert a horizontal tab, you would then simply use (char) 9

Hope this helps.

Regards,
Alex

"Mark" <ma*****@kc.rr.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
> I have a C# app that I am writing which is going to insert text into a > table, which is then picked up by another program and emailed. On the text
> version of the email (when the user doesn't have html email), I need to put
> tabs in between columns of data and then line feeds after each row. How can
> I do this? Right now I'm doing "\t" for tab and "\r\n" for line
feed, but
> when I generate the text, those characters actually come out in the

text.
>
> Please help.
> Mark
>
>



Nov 13 '05 #5
Mark,

Escape sequences are only interpreted when doing some sort or "Formatted"
operation such as writing to the Console or a file, or in the case of the
StringBuilder, AppendFormat().

To insert formatting characters into a string, try the following:
StringBuilder sb = new StringBuilder();

sb.Append("Text...");

sb.AppendFormat("\t\t");

sb.Append("More Text");

sb.AppendFormat("\r\n");

sb.Append("New Line");

Console.WriteLine( sb.ToString () );

Dan


"Mark" <ma*****@kc.rr.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
I have a C# app that I am writing which is going to insert text into a
table, which is then picked up by another program and emailed. On the text version of the email (when the user doesn't have html email), I need to put tabs in between columns of data and then line feeds after each row. How can I do this? Right now I'm doing "\t" for tab and "\r\n" for line feed, but
when I generate the text, those characters actually come out in the text.

Please help.
Mark

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Raed Sawalha | last post: by
5 posts views Thread by Lyle A. Sieren | last post: by
1 post views Thread by Programmer | last post: by
4 posts views Thread by Carsten | last post: by
1 post views Thread by Nalaka | last post: by
1 post views Thread by rengaraj | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.