IBM's JXL mode (export from the database)

xiaoxiao2021-03-04  49

Package Excelfile; Import Java.Text.dateFormat; Import Java.util. *; Import Java.io. *; Import JXL. *;

/ ** *

Title: *

Description: *

Copyright: Copyright (c) 2004 *

Company: * @ Author not attributable * @version 1.0 * /

Public class jxlcreateexcel {public jxlcreateexcel () {}

public void getExcelFile () {String tableName = "EXCEL_OUTPUT_TEST_REALDATA_2"; String im = ""; String sid = "oral"; String server = "10.254.100.25"; String whereItem = "rownum <3375"; try {jxl.write. WritableWorkbook book = Workbook.createWorkbook (new File ( "/home/ljz/filestest/jxlEXCEL_OUTPUT_TEST_REALDATA_2.xls")); jxl.write.WritableSheet sh = book.createSheet ( "jxltest", 0); DBAccess dbaccess = new DBAccess () ; dbaccess.setSelectItems (tableName); dbaccess.setSid (sid); dbaccess.setServer (server); dbaccess.setItems (im); dbaccess.setWhereItem (whereItem); Hashtable sels = null; sels = dbaccess.getSelectData (); int Hashelement = SELS.SIZE (); for (int y = 0; y

public static void main (String args []) {Date time = new Date (); DateFormat fullDateFormat = DateFormat.getDateTimeInstance (DateFormat.LONG, DateFormat.LONG); System.out.println ( "The process start time:" fullDateFormat .format (time)); jxlcreateExcel jxlexcle = new jxlcreateExcel (); try {jxlexcle.Getexcelfile ();} catch (exception e) {E.PrintStackTrace ();} Date Time1 = new date (); system.out.println ("The process end time:" fulldateformat.format (Time1));}}

转载请注明原文地址:https://www.9cbs.com/read-31638.html

New Post(0)