Excel buff Want to export numbers as numbers in Excel
SPost29
Member Posts: 148
I want to have the numbers I export to Excel using the Excel buffer table to be numbers
when I open Excel.
I currently get "The number in this cell is formatted as text or preceded by an apostrophe"
Then there is a process I can choose: 'Convert to Number'
I want it to convert to number automatically so my users or I don't have to mess with it manually.
How can I get my exported numbers to be numbers?
Thanks
Steve
when I open Excel.
I currently get "The number in this cell is formatted as text or preceded by an apostrophe"
Then there is a process I can choose: 'Convert to Number'
I want it to convert to number automatically so my users or I don't have to mess with it manually.
How can I get my exported numbers to be numbers?
Thanks
Steve
0
Answers
-
Hi Steve,
How are using the Excel Buffer table?
Set the NumberFormat or set the last agrument on the AddColumn function as per formating a cell in Excel0 -
Hi Dave,
Thanks for your response
I am using on the OnPreSection of a report
EnterCell(RowNo,10,FORMAT("Outstanding Amount"),FALSE,FALSE,'@'); // for numbers
EnterCell(RowNo,3,"Vendor Item No.",FALSE,FALSE,''); // for textEnterCell(RowNo : Integer;ColumnNo : Integer;CellValue : Text[250];Bold : Boolean;UnderLine : Boolean;NumberFormat : Text[30]) ExcelBuf.INIT; ExcelBuf.VALIDATE("Row No.",RowNo); ExcelBuf.VALIDATE("Column No.",ColumnNo); ExcelBuf."Cell Value as Text" := CellValue; ExcelBuf.Formula := ''; ExcelBuf.Bold := Bold; ExcelBuf.Underline := UnderLine; ExcelBuf.NumberFormat := NumberFormat; ExcelBuf.INSERT;
This all works fine except:
This gives me the "The number in this cell is formatted as text or preceded by an apostrophe" message in Excel
Thanks
Steve0 -
Hi Steve,
The @ sign tells Excel to format the cell as text - try a number format e.g. '0.00' for two decimal places. To see further examples - go to Excel and in Format Cells - look at the examples in the custom option.EnterCell(RowNo,10,FORMAT("Outstanding Amount"),FALSE,FALSE,'@'); // for numbers0 -
One tip that I found useful is when you want to accomplish something in Excel in C/AL code, is to turn on the macro recorder in Excel. Then do what you want to do, and look at the VBA that the macro recorder generated. Usually that translates almost directly into C/AL. I know formatting works that way, I've done something with that in the past.0
-
Thanks to both of you. That will do it.
Steve0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
