Book Image

Microsoft Dynamics AX 2012 R3 Development Cookbook

By : Mindaugas Pocius
Book Image

Microsoft Dynamics AX 2012 R3 Development Cookbook

By: Mindaugas Pocius

Overview of this book

<p>Microsoft Dynamics AX 2012 R3 Development Cookbook will help you manage your company's or customer's ERP information and operations efficiently. Beginning with exploring data manipulation concepts in Dynamics AX, you will build scripts to assist data migration and organize data in AX forms. You will learn how to create custom lookups using AOT forms and generate them dynamically. After this, you'll learn how to enhance your application by using advanced form controls, and integrate your system with other external systems. You will also learn how to enhance your user interface using various Dynamics AX UI elements.</p> <p>This book will help you look at application development from a business process perspective, and develop enhanced ERP solutions by learning and implementing the best practices and techniques.</p>
Table of Contents (16 chapters)
Microsoft Dynamics AX 2012 R3 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Reading an Excel file


In Dynamics AX, data can be retrieved from Excel files with the help of the same SysExcel classes that we used to create Excel files. These classes provide a simple interface for developers to access and read data in Excel files.

In this recipe, we will demonstrate how to read Excel files using the SysExcel classes. We will read the file created in the previous recipe and display its contents in the Infolog window.

How to do it...

Carry out the following steps in order to complete this recipe:

  1. In the AOT, create a new job named ReadExcelFile with the following code snippet (replace the filename with your own):

    static void ReadExcelFile(Args _args)
    {
        SysExcelApplication excel;
        SysExcelWorkbooks   workbooks;
        SysExcelWorkbook    workbook;
        SysExcelWorksheets  worksheets;
        SysExcelWorksheet   worksheet;
        SysExcelCells       cells;
        COMVariantType      type;
        int                 row;
        CustAccount         account;
        CustName            name;
      ...