ExcelBuffer Currency formatting
samyeg
Member Posts: 3
I'm new to NAV development and I have a function to export data from NAV to Excel, the problem is I cannot format the cells in currency format, this is an example of the code:
What is need is to display numbers as $10,000.00
Can someone help me please?
Thanks.
// Displays the field as Text.
ExcelBuf.AddColumn('$' + FORMAT(PurchLine."Direct Unit Cost"),FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Text);
// and/or
// Displays the field as number but without the currency format ($)
ExcelBuf.AddColumn(PurchLine."Direct Unit Cost",FALSE,'',FALSE,FALSE,FALSE,'',ExcelBuf."Cell Type"::Number);
What is need is to display numbers as $10,000.00
Can someone help me please?
Thanks.
0
Comments
-
You can use ExcelBuf.NumberFormat
e.g.
ExcelBuf.AddColumn(PurchLine."Direct Unit Cost",FALSE,'',FALSE,FALSE,FALSE,'','$####.00');0 -
Well, Thanks 'nav_development' for your reply.
Unfortunately, I used the suggested solution but it didn't work for me, So I used something we used to have in .net Development, right click on "AddColumn" method and choose "Go to Definition", in the definition I found that 7th parameter is 'NumFormat', so i got the number format string form Excel and passed it as text format parameter of the method and it worked! =D>
this is the code I used:// $ 10,000.00 ExcelBuf.AddColumn(PurchLine."Direct Unit Cost",FALSE,'',FALSE,FALSE,FALSE,'_($* #,##0.00_)',ExcelBuf."Cell Type"::Number);
0 -
Ohh..thanks for posting feedback. it works well in my case. Which version are you using?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions