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

Export table records to Excel

From Axaptapedia
Jump to: navigation, search

I have created a simple class to export records from a table (or temp table) to an excel file.

Download

Please note that the code doesn't come with any warrenty.

--Fattung 04:37, 12 April 2007 (EDT)


Little job example shows how to send data to excel:

static void Send_toExcel(Args _args) {

   SysExcelApplication         ExcelApplication;
   SysExcelWorkBooks           ExcelWorkBooks;
   SysExcelWorkBook            ExcelWorkBook;
   SysExcelWorkSheets          ExcelWorkSheets;
   SysExcelWorkSheet           ExcelWorkSheet;
   SysExcelRange               ExcelRange;
   CustTable                   ct;
   int                         row;
   ;
   ExcelApplication = SysExcelApplication::construct();
   ExcelApplication.visible(true);
   ExcelWorkBooks = ExcelApplication.workbooks();
   ExcelWorkBook = ExcelWorkBooks.add();
   ExcelWorkSheets = ExcelWorkBook.worksheets();
   ExcelWorkSheet = ExcelWorkSheets.itemFromNum(1);
   while select * from ct
   {
       row++;
       ExcelWorkSheet.cells().item(row,1).value(ct.AccountNum);
       ExcelWorkSheet.cells().item(row,2).value(ct.Name);
   }

} --Gundhawk 02:30, 15 September 2007 (EDT)


Version History[edit]

Ver 0.1 - Enums and Strings are now formatted as string instead of "General" -- Fattung 22:52, 26 April 2007 (EDT)