AL icon indicating copy to clipboard operation
AL copied to clipboard

Excel buffer .NET variables not defined

Open achecac opened this issue 7 years ago • 1 comments

I am trying to load an excel sheet using standard excel buffer procedures but I cant. I am trying on BC Cloud (SaaS)

My code is

codeunit 50104 CargaDatos { trigger OnRun()

begin UploadIntoStream('Carga Fichero', 'C:\Users\achec\OneDrive\Publico', 'Archivos Excel (.xlsx)|.xlsx', NombreFicheroLocal, FicheroInStream); Nombrehoja := ExcelBuf.SelectSheetsNameStream(FicheroInStream); ExcelBuf.LOCKTABLE; ExcelBuf.OpenBookStream(FicheroInStream, ''); ExcelBuf.ReadSheet(); celdasleidas := excelbuf.Count; Message('Celdas leidas %1', format(celdasleidas)); end;

var ExcelBuf: Record "Excel Buffer"; FicheroInStream: InStream; ServerFileName: Text; NombreHoja: Text; NombreFicheroLocal: Text; celdasleidas: Integer; }

but I get error:

A DotNet variable has not been instantiated. Attempting to call Microsoft.Dynamics.Nav.OpenXml.Spreadsheet.WorksheetReader.GetEnumerator in Table Excel Buffer: ReadSheetContinous

If I navigate table excel buffer, and check procedure ReadSheetContinuous I get the following surprise with the variables not defined:

So, I do not know what to do!

Anyway, I executed report EXCEL BUDGET IMPORT (BC SaaS) and surprisingly it is working fine using these procedures.

By then way: I have found no documentation at all on standard calls like ExcelBuf.ReadSheet

Is this a bug? How could we workarround ?

achecac avatar Jul 11 '19 21:07 achecac

ExcelBuf.OpenBookStream(FicheroInStream, '');

I was missing second parameter!!! Closing.

achecac avatar Jul 12 '19 23:07 achecac