Wednesday, 28 January 2015

Keeping Leading Zeros while exporting to excel

While exporting the data to excel in NAV 2009, i faced a different problem.

I have a value for "Vendor Bank Acc. No." = 00027928.

But while exporting to excel the leading zero's will automatically deleted and displayed as 27928.(Its default excel functionality).

And the workaround for above problem is : put a ' before your field so Excel treats it as text.

EnterCell(Row, Column, '''' + "Vendor Bank Acc. No.", FALSE, FALSE, FALSE); 


add the '''' + before the field (4 single quotes).