Excel Import/Export
In nexacro platform, we can implement Excel Import/Export using nexacro-xeni.war module provided by TOBESoft.
Excel Export/Import use POI(Jakarta POI) module.
Preparation
1) Download nexacro-xeni.war file from Technical Support homepage. Example) nexacro-xeni.war (File name to be downloaded consists of file name and built date.) (nexacro-xeni.war_2014.04.22.zip)
2) Unzip the zip file of 1)
3) Unzip the nexacro-xeni.war.
4) Copy the unzipped nexacro-xeni folder to WAS path.
The export/import folders will be created automatically when we run the excel import and export.
5) Copy Server License of nexacro x-api into lib folder. (This License is provided when you purchase)
6) Restart the WAS.
6) Checking whether it is installed normally or not You can verify whether the module is installed normally or not via Web brosewer XML screen as below.
If you completed above steps normally, you are prepared to work excel.
Checkpoint, when you have a error in accessing nexacro-xeni folder.
After option setting is completed, If you can not access the nexacro-xeni folder, you need to set the path to be accessed in WAS. Example) In case of Tomcat, set the Context path in server.xml.
Export
This describes the way to Export the grid contents to Excel.
Basic
By clicking Export button, the contents in grid will be exported to excel.
If window like above image is opened, you can select button among 'open', 'save' and 'as save' button.
When you export excel, if window like above image does not appear and is opened on web browser, You need to add mime-mapping in web.xml in WAS and restart WAS. After adding mime-mapping you can verify the same result as above.
We can verify the contents expressed in grid on excel.
Event
We can verify the processing result of excel using event.
Name | Description |
---|---|
onerror | This event occurs when there is a error under exporting |
onprogress | This event occurs while exporting by progress condition. |
onsuccess | This occurs when export is completed. |
Main Source Content
this.url = "http:// WAS Path /nexacro-xeni/XExportImport"; this.Button00_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { this.ExcelExportObject00 = new ExcelExportObject(); this.ExcelExportObject00.addEventHandler("onprogress", this.ExcelExportObject00_onprogress, this); this.ExcelExportObject00.addEventHandler("onsuccess", this.ExcelExportObject00_onsuccess, this); this.ExcelExportObject00.addEventHandler("onerror", this.ExcelExportObject00_onerror, this); var ret = this.ExcelExportObject00.addExportItem(nexacro.ExportItemTypes.GRID, this.gd_excel, "Sheet1!A1"); this.ExcelExportObject00.set_exportmessageprocess("%d [ %d / %d ]"); this.ExcelExportObject00.set_exportuitype("exportprogress"); this.ExcelExportObject00.set_exporteventtype("itemrecord"); this.ExcelExportObject00.set_exporttype(nexacro.ExportTypes.EXCEL2007); this.ExcelExportObject00.set_exportfilename("ExcelExport_Sample"); this.ExcelExportObject00.set_exporturl(this.url); this.ExcelExportObject00.exportData(); }
Source location
Sample\Excel\np_ExcelExport.xfdl
I want to know the way to export the contents in grid into excel.
Import
This describes the way to import the excel file into grid.
Basic
Importing Excel file
The excel file which you want to import should be the same as DataSet information bound to Grid.
Sample File)
http://www.xplatform.co.kr:8080/Next_JSP/nexacro/Sample/Excel/file/ExcelExport_Sample.xlsx
Event
We can verify the processing result of excel using event.
Name | Description |
---|---|
onerror | This event occurs when there is a error under exporting |
onsuccess | This occurs when export is completed. |
Main Source Content
this.url = "http:// WAS Path /nexacro-xeni/XImport"; this.importObj = null; this.Button02_onclick = function(obj:Button, e:nexacro.ClickEventInfo) { if(this.importObj == null){ this.importObj = new nexacro.ExcelImportObject("Import00",this); this.importObj.set_importtype(nexacro.ImportTypes.EXCEL); this.importObj.addEventHandler("onsuccess", this.Import00_onsuccess, this); this.importObj.addEventHandler("onerror", this.Import00_onerror, this); } this.importObj.set_importurl(this.url); this.TextArea00.set_value(this.TextArea00.value + "\n"+ "importurl set :" + this.url); this.importObj.importData("","Sheet1!A1:F6","ds_excel"); this.TextArea00.set_value(this.TextArea00.value + "\n"+ "importData() Method"); }
Source Location
Sample\Excel\np_ExcelImport.xfdl Sample\Excel\file\ExcelExport_Sample.xfdl