Read and Generate Excel and Word files

Now you can generate Excel and Word File with NO extra charge, using Jakarta POI

Requirements:

  • .NET Framework 2.0
  •  JSharp framework 2.0
  • Configure your model to compile and execute with Framework 2.0
  • DLL from Jakarta poi

Install JSharp (vjredist)

Install the DLL from Jakarta in your model (jakartapoi-winfx-dll-251-3), if you are compiling for WEB, put them on “DATAxxx/web/bin/”

Now you are ready to Read or Create Excel or Word files, here an example:

 

&excel is ExcelDocument Type

Place the “UseAutomation” = 0 before the “Open” command line.

 

 

Event "Excel"    &excel.UseAutomation = 0     &excel.Open(&File)      If &excel.ErrCode <> 0         msg(&excel.ErrDescription)     else         &excel.Clear()               &excel.Cells(1,1).Text = 'Customers list'          &excel.Cells(1,1).Bold = 1         &excel.Cells(1,1).Color = 54         &excel.Cells(1,1).Size = 10                  &excel.Cells(3,1).Text = 'Customer Id'         &excel.Cells(3,1).Italic = 1         &excel.Cells(3,1).Bold = 1              &row = 4         &col = 1         For each line in Grid                      &excel.Cells(&row,&col).Number = CustomerId                 &excel.Cells(&row,&col).Color = 3                 &row  = 1                           endfor          &excel.Save()      endif EndEvent 

Leave a Reply

Your email address will not be published. Required fields are marked *