Pages

Thursday 13 November 2014

Navision 2009 : Excel create in Report using Excel buffer and Automation

There are many ways to create a Excel from Report in the Microsoft Dynamics NAV 2009.
1. Using Excel Buffer table
2. Using Automation variable

Using Automation variable is faster way to create Excel.

Variable in Report
Name    DataType    Subtype
Excel    Automation    'Microsoft Excel 12.0 Object Library'.Application   
Book    Automation    'Microsoft Excel 12.0 Object Library'.Workbook   
Range    Automation    'Microsoft Excel 12.0 Object Library'.Range   
Sheet    Automation    'Microsoft Excel 12.0 Object Library'.Worksheet
j           Text                 30

OnPreReport
  CREATE(Excel,TRUE,TRUE);
  Excel.Visible(TRUE);
  Book:=Excel.Workbooks.Add();
  Sheet:=Excel.ActiveSheet;
  Sheet.Name := 'Sheet Name';