Excel Formatting

Hello Everyone, I have a small problem in exporting data to Excel from Navision. I have written code to export and invoice to Excel as the client required a soft copy in Excel, i have used Automation variables, everything works fine, all the data that i want output to excel does go through fine but the Amounts / Quantites etc, basically all the numeric figures are formatted in a currency, hence in Excel it shows a currency sign and decimal in the quantity field also. Is there anyway to format Excel Sheet Cells through Navision before or after transfering data ?? Thanx Vishal

Hi Before writting into excel use FORMAT command in Navision. Eg. sheet.Range(strCellAddress).VAULE := FORMAT (intValue) I think this will do the functionality that you required. Regards Joseph Mathew Edited by - joseph_mathew on 2001 May 14 09:17:39

Hi, You can use the following syntax: For text: Sheet.Range(YourRange).NumberFormat := ‘@’; For numbers Sheet.Range(YourRange).NumberFormat := ‘#.##0,00’; or Sheet.Range(YourRange).NumberFormat := ‘#.##0’; or if you waant to use different colors: Sheet.Range(YourRange).Font.ColorIndex := 5; // blue Sheet.Range(YourRange).Font.ColorIndex := 3; // red Sheet.Range(YourRange).Font.ColorIndex := 10; // green Best regards Preben


You can use the following syntax:

This is entirely correct. However I would follow a different approach: Create and Layout your Invoice manually and apply all style settings (number formats, rowheight, colwidth, colours, fonts, page-format and -size, -borders) etc. You might even apply the company logo as you wish. Then clear all non-constant items and save the now formated but empty invoice as template. From within Navision you simply open this template, fill out the data and save it under a different name. This method has the big advantage that you don’t have to care within your C/SIDE code how the invoice is formated. If the user wants a different font he can simply do it himselfes. No programming is required. ------- With best regards from Switzerland Marcus Fabian

Thank you so much for the help offered it works now. this site is really a help to all Navision People…!!! I appreciate the effort and time !!! keep up the good thanx again

Thank you for your kind words. But keep spreading it to all your Navision co-workers and friends. Soon we will release a very much improved/new designed up/download area. Best regards, Erik P. Ernst, webmaster Navision Online User Group