Format data in creating excel output

couberpu
couberpu Member Posts: 317
Hi ALL,

I have Navision 3.70b Navision run time with SQL options.

I am trying to create an Excel output using Automation. Everything is working but I nned to format the data, like in Excel Format Cells.., with custom format like '00000;#####'. Can any one give me a direction on how to do it and Is there a Navision docutmentation for doing something like this?


Thanks a lot,
CouberPu

Answers

  • Savatage
    Savatage Member Posts: 7,142
    is the "###" your field and you want to add zero's in front?
  • couberpu
    couberpu Member Posts: 317
    Yes, something like that. It is for formating customer account# like 00001, 05675. When customer account like 00001 and 05675 or Zip code like 08600, I would use Excel Custom format 00000;##### to make sure that I did not lost the leading 0. Now I am creating Excel output, along with Navision report output, in Navision report, I would like to be able to do something like WorkSheet.Range('A1').<Format> := <FormatStr>. But I have no idea what <Format> and <FormatStr> are!

    Thanks,
    CouberPu
  • couberpu
    couberpu Member Posts: 317
    I found the answer of my question in Microsoft Visual Basic Help.
    I made the change to my code like this:

    WorkSheet.Range('A'+FORMAT(i)).Value := Customer."No.";
    WorkSheet.Range('A'+FORMAT(i)).NumberFormat:= '00000;#####';


    and the output has leading zeros on customer#.

    Thanks,
    CouberPu