Export to multiple sheet in excel - Nav 2018

Djou2424
Member Posts: 76
I'm looking for an exemple of how to export data to excel in Navision 2018 using multiple sheets.
We have a custom report for one of our client in nav 2013 R2 that export orders informations to different excel spreadsheet.
Now that we are upgrading them to 2018, the code is not working anymore
Here is part of the code in 2013 R2 that is working fine:
ExcelBuf.OnlyCreateBook('ABC', 'ABC',COMPANYNAME, USERID,TRUE);
ExcelBuf.DELETEALL;
Here is the error message we get in 2018 when running the same report

Here is where in the code of the excel buffer table it's failing


We have a custom report for one of our client in nav 2013 R2 that export orders informations to different excel spreadsheet.
Now that we are upgrading them to 2018, the code is not working anymore
Here is part of the code in 2013 R2 that is working fine:
ExcelBuf.OnlyCreateBook('ABC', 'ABC',COMPANYNAME, USERID,TRUE);
ExcelBuf.DELETEALL;
Here is the error message we get in 2018 when running the same report

Here is where in the code of the excel buffer table it's failing


0
Answers
-
OnlyCreateBook is no standard function. Nor are the Add... functions.
ExcelBuffer used to use Automation in order to remote control Excel. It now uses Dotnet OpenXML library to create a document directly.
You will have to re-implement extensions to your Excel Buffer using that library.0 -
Ok, do you know where I could find an example of how to do that?0
-
Still looking for help on how to do this0
-
try this:
AddSheet(SheetName : Text[250])
CurrentRow := 0;
CurrentCol := 0;
XlWrkShtWriter := XlWrkBkWriter.AddWorksheet(SheetName);
IF SheetName <> '' THEN BEGIN
XlWrkShtWriter.Name := SheetName;
ActiveSheetName := SheetName;
END;
ChangeSheet(SheetName : Text[250])
XlWrkShtWriter := XlWrkBkWriter.GetWorksheetByName(SheetName);
IF SheetName <> '' THEN BEGIN
XlWrkShtWriter.Name := SheetName;
ActiveSheetName := SheetName;
END;
WrkShtHelper := WrkShtHelper.WorksheetHelper(XlWrkBkWriter.GetWorksheetByName(SheetName).Worksheet);
Worksheet := XlWrkShtWriter.Worksheet;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions