By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,667 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,667 IT Pros & Developers. It's quick & easy.

line feed and tab

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.