Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 931125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:27:05+00:00 2026-05-15T20:27:05+00:00

I am trying to print a table inside an e-mail using plain text. I

  • 0

I am trying to print a table inside an e-mail using plain text.
I have the following code:

string body = string.Format("{0,-30}{1,-30}{2,-50}{3,-40}",
                                   "Col1", "Col2", "Col2", “Col4”);

body += string.Format("{0,-30}{1,-30}{2,-50}{3,-40}",
                                value1, value2, value3, value4);

Microsoft.Office.Interop.Outlook.ApplicationClass myOutlookApplication = null;
myOutlookApplication = new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.MailItem myNewMail = 
    (Microsoft.Office.Interop.Outlook.MailItem)myOutlookApplication.CreateItem( 
      Microsoft.Office.Interop.Outlook.OlItemType.olMailItem );            

myNewMail.To = recipient;
myNewMail.Subject = subject;
myNewMail.Body = body;
myNewMail.BodyFormat = OlBodyFormat.olFormatPlain;            

myNewMail.Send();

The problem I have is that the text for the body does not line up. It also seems to wrap the text inside the mail. Can anyone tell me what I may be doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:27:06+00:00Added an answer on May 15, 2026 at 8:27 pm

    Creating (or actually imitating the behaviour of) a table in plain text only works well when:

    1. The values in your tables are exactly the same width as the widht of the column. This is something you (the programmer) should take care of by trailing the text with spaces when the text is too short or cutting of the text if is too long.

    2. The user that is receiving the text is using a monospace font (http://en.wikipedia.org/wiki/Monospaced_font) to view the table. And that is unfortunately beyond your control if you send the table in an e-mail message…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It is possible to POST to a hidden iframe. Therefore,… May 16, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer First of all, please keep in mind that Objective-C is… May 16, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer url(/body-bg.gif) is skipped by ie7 use url(body-bg.gif) instead! May 16, 2026 at 5:01 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In the below image I am trying to achieve the following.I have a table
I have installed rapache and I am trying to fit a linear model inside
Is there a way to only print or output 10 elements per row inside
I am trying to reference a JavaScript file, containing a table sort function, in
Trying to perform a very simple task here. I have an <ol> that contains
I am trying to email the content of a Div. We have a booking
I wanted to use a Rich Text Editor for a text area inside an
Drupal version 6.12 I have a page whose input format is PHP. I simply
Consider the following table: mysql> select * from vCountryStatus; +-------------+------------+------+---------+--------+-----------------+ | CountryName | CountryISO
I'm trying to use dom4j to parse an xhtml document. If I simply print

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.