Outlook Body text Tab character insertion

DivyaDivya Member Posts: 125
Hi,

I used "Mail" Codeunit to create mails from navision. I have added body text of the mail. But I need to write in the mail like,

XXXX <tab> : <tab> X1
YYYY <tab> : <tabl> Y1

It should be aligned properly, and Here my code is,

Chr9 := 9;
Chr13 := 13;
MailMgt.AddBodyline('XXX' + Chr9 + ':' + Chr9 + 'X1' + Chr13);
MailMgt.AddBodyline('YYY' + Chr9 + ':' + Chr9 + 'Y1' + Chr13);

But instead of TAB, it is printing as SPACES. It is not alligned properly. I could not find out the issue.
Please give me any idea about this issue.

Thanks,
Divya
Victory is sweetest when you've known defeat

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I guess Chr9 and Chr13 are of Data Type Char.

    Use
    MailMgt.AddBodyline('XXX' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'X1' + FORMAT(Chr13));
    MailMgt.AddBodyline('YYY' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'Y1' + FORMAT(Chr13));
    
  • DivyaDivya Member Posts: 125
    Hi,

    Yes. I used like this way only.. Sorry i missed format() when i post the code.
    Still im facing same issue.

    Thanks,
    Divya
    Victory is sweetest when you've known defeat
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I used following code rather than using .AddBodyline function and working fine..
    Chr9 := 9;
    Chr13 := 13;
    
    BodyTxt := ('XXX' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'X1' + FORMAT(Chr13));
    BodyTxt := BodyTxt + ('YYY' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'Y1' + FORMAT(Chr13));
    
    MailMgt.NewMessage('abc@gmail.com','','Hi',BodyTxt,'',FALSE);
    MailMgt.Send;
    

    Can you show your code please..
  • DivyaDivya Member Posts: 125
    hi.. try this code..
    Chr9 := 9;
    Chr13 := 13;
    
    BodyTxt := ('XXXXX' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'X1' + FORMAT(Chr13));
    BodyTxt := BodyTxt + ('YYYYYYY' + FORMAT(Chr9) + ':' + FORMAT(Chr9) + 'Y1' + FORMAT(Chr13));
    
    MailMgt.NewMessage('abc@gmail.com','','Hi',BodyTxt,'',TRUE);
    
    Victory is sweetest when you've known defeat
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Offcorce, here You have 5 X's in first line and 7 Y's in second line..

    If you have equal No. of letters in both lines then the allignment will be proper..
  • DivyaDivya Member Posts: 125
    BUT, if im entering text manually in the outlook new mail message body section, It is working. It is aligned properly.

    if 1st sentence chars is more than 2nd sentense, i can change the code to put 2 tab position, that is not a problem.
    But even if i use 2 tab positon, it is not aligning.
    Victory is sweetest when you've known defeat
Sign In or Register to comment.