Hi all,
Yesterday we had seen the changes in Excel Buffer in NAV 2013, but there is one more conman way that we used to use in NAV 2009 For Export to Excel Reports (i.e Enter Cell Function in Report).
Lets discuss that today. The Idea for this post came from Ms +shubhangi verma.
Let's see what changes we need to do in a export to excel report created in NAV 2009 or Previous Version to use in NAV 2013 with ENTERCELL.
we have a sample report in NAV 2009 Which we used for Demo about how to export in Excel. Below is the code written on Report.
OnReportTriggers -
OnDataItem -
Now i will try to import the report in NAV 2013 and try to upgrade or compile report.
When you try to upgrade report, the error will come that you need to compile Report, But when you try to compile Report we get below error message.
The error is due to Code written to Export to Excel.
Resolution -
1. IN NAV 2009 just comment the code Related to Create Sheet.
2. Export objects from 2009 and import it in NAV 2013.
3. Compile the Report and upgrade it (From Tools Menu - Upgrade Report).
4. Once Upgraded Change the Functions as shown below -
Comment all code in OnPostReport and replace with single line.
ExcelBuffer.CreateBookAndOpenExcel(SheetName,ReportHeader,CompanyName,UserID2)
If you try to Run this report now you will get an empty excel sheet.
Why?
Because you haven't specified the Cell Type Parameter for the data.
Let's see the changes that we need to do -
Changes in EnterCell Function -
a) Add a Option Type Parameter CellType with Options (Number,Text,Date,Time).
b) Add a line of code to Specify the Cell Type.
ExcelBuf."Cell Type" := CellType;
Changes in Code -
Add the Value for New Parameter added in Enter Cell based on the field format.
I have added some more fields than NAV 2009 Report, just to show how to specify the value for cell type.
Save the Report and Run it.
There are other changes also done which will be based on requirement.
In Next post we will see how to auto save a Export to Excel Report in a specified path in the setup.
Regards,
Saurav Dhyani
www.sauravdhyani.com
Yesterday we had seen the changes in Excel Buffer in NAV 2013, but there is one more conman way that we used to use in NAV 2009 For Export to Excel Reports (i.e Enter Cell Function in Report).
Lets discuss that today. The Idea for this post came from Ms +shubhangi verma.
Let's see what changes we need to do in a export to excel report created in NAV 2009 or Previous Version to use in NAV 2013 with ENTERCELL.
we have a sample report in NAV 2009 Which we used for Demo about how to export in Excel. Below is the code written on Report.
OnReportTriggers -
OnDataItem -
Now i will try to import the report in NAV 2013 and try to upgrade or compile report.
When you try to upgrade report, the error will come that you need to compile Report, But when you try to compile Report we get below error message.
The error is due to Code written to Export to Excel.
Resolution -
1. IN NAV 2009 just comment the code Related to Create Sheet.
2. Export objects from 2009 and import it in NAV 2013.
3. Compile the Report and upgrade it (From Tools Menu - Upgrade Report).
4. Once Upgraded Change the Functions as shown below -
Comment all code in OnPostReport and replace with single line.
ExcelBuffer.CreateBookAndOpenExcel(SheetName,ReportHeader,CompanyName,UserID2)
If you try to Run this report now you will get an empty excel sheet.
Why?
Because you haven't specified the Cell Type Parameter for the data.
Let's see the changes that we need to do -
Changes in EnterCell Function -
a) Add a Option Type Parameter CellType with Options (Number,Text,Date,Time).
b) Add a line of code to Specify the Cell Type.
ExcelBuf."Cell Type" := CellType;
Changes in Code -
Add the Value for New Parameter added in Enter Cell based on the field format.
I have added some more fields than NAV 2009 Report, just to show how to specify the value for cell type.
Save the Report and Run it.
There are other changes also done which will be based on requirement.
In Next post we will see how to auto save a Export to Excel Report in a specified path in the setup.
Regards,
Saurav Dhyani
www.sauravdhyani.com
Comments
Post a Comment