Axaptapedia is now maintained by AgileCadence For more information please click here.

Difference between revisions of "ExcelIo"

From Axaptapedia
Jump to: navigation, search
(How to use)
(How to use)
Line 10: Line 10:
 
Just use ExcelIo as a replacement for CommaIo.
 
Just use ExcelIo as a replacement for CommaIo.
  
<xpp>
+
static void ExcelIoTest(Args _args)
static void ExcelIoTest(Args _args)
+
{
{
+
 
     ExcelIo io;
 
     ExcelIo io;
 
     #Excel
 
     #Excel
Line 32: Line 31:
 
     }
 
     }
 
     io.close(); //To quit Excel
 
     io.close(); //To quit Excel
}
+
}
</xpp>
+
  
 
[[Category:Development tools]]
 
[[Category:Development tools]]

Revision as of 10:44, 21 December 2015

Purpose

To read an Excel file in way mimicking CommaIo.

The writeExp method is not implemented.

Download

File:Class ExcelIo.xpo XPO file for Axapta 3.0 and up

How to use

Just use ExcelIo as a replacement for CommaIo.

static void ExcelIoTest(Args _args)
{
   ExcelIo io;
   #Excel
   dialogField dialogFilename;
   Dialog dialog = new Dialog("Excel Upload");
   container con;
   ;
   dialogFilename = dialog.addField(typeId(FilenameOpen));
   dialog.filenameLookupTitle("Upload from Excel");
   dialog.filenameLookupFilter(["@SYS28576",#XLSX, "@SYS28576",#XLS]);
   if (!dialog.run())
       return;
   io = new ExcelIo(dialogFilename.value(), 'r');
   setprefix("Excel Import");
   while (io.status() == IO_Status::Ok)
   {
       con = io.read();
       info(con2str(con));
   }
   io.close(); //To quit Excel
}