Export to Excel via a dataport : field's format need to choose

Hi all, I created a dataport to export Items list for example…

The Item Number field is coded like this :

0001 : Item one

0002 : Item two

0012 : Item 12

9999 : Last Item

After exporting to Excel, In the column of the item number, I have this format (Standard format on Excel) :

1

2

12

9999

In C/Side, can I to choose the column format in Excel for every field or data I exported…

with dataport first… or whith other ways…

Thanks

The problem is that a dataport simply generates a TXT file, you simply are using excel to open it as a CSV file. If you export it as a TXT file, then when you open it in EXCEL you will get the Text file wizard which will enable you to define the field properties. The other option is to open it within Notepad.

Hope this is of help

Andrew

Hi Kamel,

Andrew is correct - the standard way to export to Excel from Nav is to use the Excel Buffer table (table 370) and functions. For your situation you can set the last argument on the AddColumn function to ‘@’ to format as a string i.e. assigning the numberformat field. Look at the export to excel option in the budget screen for examples.

Thanks Andrew, Thanks DaveT…

I resume :

  1. With dataport there is no technical issue to choose the “format of the cell” (Standard, Text…) coz the standard way is not dataport; it’s Excel Buffer use.

  2. With the Excel Buffer T370, It works : I have tried with NumberFormat field in table 370 coz the code I have changed to test doesn’t use the AddColumn function… (AddColumn function in table 370 uses the field NumberFormat to fix the format of Excel cell)

Thanks both…

Glad to Help [:D]