O'Reilly logo

Microsoft Dynamics NAV 7 Programming Cookbook by Rakesh Raul

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exporting data using the Excel Buffer

NAV contains a wrapper object that allows you to export data to Microsoft Excel. This recipe will show you how to use it in its most common form—exporting a report to Excel.

Getting ready

Microsoft Excel must be installed on the client machine.

How to do it...

  1. Create a new processing-only report based on the Customer table.
  2. Add values in the No., Name, and Balance fields.
  3. Add the following global variables:

    Name

    Type

    SubType

    ExcelBuf

    Record

    Excel Buffer

  4. Let's set the property Temporary of the ExcelBuf variable to Yes.
  5. Now add a function named MakeExcelInfo.
  6. Add the following code to the function:
    ExcelBuf.SetUseInfoSheet; ExcelBuf.AddInfoColumn(FORMAT('Company Name'),FALSE,'',TRUE,FALSE,FALSE,'',ExcelBuf."Cell ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required