Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Hide zeros in Excel export

Posted on by 157

Hello everyone

I try to export the fields of a table with sysExcelApplication.

in one of the fields, where i have the itemid(which is string) when the export finished all zeros that leading the itemId number are disappered.

That has no sense because is a string. 

Also I tried to change the format of the cells of the excel file to "text" but nothing happened.  

the code I have to export my cells is ....

 excelWorksheet.cells().item(i,2).value(collectionProdJournalBOM.ItemId);

does anyone know why this happens?

  • SGbron Profile Picture
    SGbron 157 on at
    RE: Hide zeros in Excel export

    It seems very helpfull...

    Thank you very much Nikolaos !!

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Hide zeros in Excel export

    .toString() function doesn't impact the format of Excel cells in any way.

    I did a quick web search for you (using search terms "dynamics ax 2009 sysExcelApplication export format cells"):

    shekhardiptiman.wordpress.com/.../

  • SGbron Profile Picture
    SGbron 157 on at
    RE: Hide zeros in Excel export

    the only thing that I can imagine for coding is

    excelWorksheet.cells().item(i,2).value(collectionProdJournalBOM.ItemId).toString();

    but it also didnt work.....

    Do you have any better idea to ensure the formatting?

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Hide zeros in Excel export

    May I suggest that you add some code to ensure correct cell formatting.

  • SGbron Profile Picture
    SGbron 157 on at
    RE: Hide zeros in Excel export

    I dont have code in my class for the format of the cell of excel.

    The only thing that has to do with this specific field is the line of code that I wrote above.

    I found a way to change it inthe cell of the Excel file with a custom formating but I dont want to do it manually.

     

  • nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Hide zeros in Excel export

    Could you share the code where you set the formatting of the cell?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,610 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans