|
Bob I have managed to convert virtually all types of data-base type fields into an excel spreadsheet using POI. Here is some cobbled code... (n.b this takes the raw bytes off the data-base file) * // new Date(long) D createDate PR O EXTPROC(*JAVA D :'java.util.Date' D :*CONSTRUCTOR) D CLASS(*JAVA D :'java.util.Date') D Parm 20i 0 value * // Cell.setCellValue(date) D setCellValDate PR EXTPROC(*JAVA D :'org.apache.poi.hssf.usermodel- D .HSSFCell' D :'setCellValue') D Parm O CLASS(*JAVA D :'java.util.Date') D* D DS1date DS 10 D DS1date10 1 10d D* D DS1time DS 8 D DS1time8 1 8t D* D DS1timeStamp DS 26 D DS1ts26 1 26z // Date field When FieldType = 'L'; evalr DS1date = %subst(iData : FieldStartPos : FieldBytesLength); valueDATE = %diff(DS1date10 : %date('1970-01-01':*iso) : *days); valueDATE = valueDATE * 24 * 60 * 60 * 1000; cell = createCell(row:c); setCellType(cell:0); date = createdate(valueDATE); setCellValDate(cell:date); setCellStyle(cell:dateCellStyle); c = c+1; HTH Mike -----Original Message----- From: Bob O. [mailto:otis_the_cat@xxxxxxxxxxx] Sent: 08 March 2005 13:17 To: rpg400-l@xxxxxxxxxxxx Subject: Dates in POI Sql2Xls I have one more issue with the POI sql2xls programs. I was trying to save an employee's hire date into a date data type field in a physical file and then move that date into the excel sheet the POI program creates. It doesn't seem to do what I want it to do (of course). Is my issue with the date field in the physical file? If so, how should I store the date in the physical file so the POI program can easily convert it to a date in the spreadsheet? When I store it in a plain old 8/0 numeric field, it just moves the text to the cell instead of formatting as a date. -- ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.F-Secure.com/ ********************************************************************** This communication and the information it contains: - (a) Is intended for the person(s) or organisation(s) named above and for no other person(s) or organisation(s). Access to this mail by anyone else is unauthorised. (b) Is confidential, and may be legally privileged or otherwise protected in law. Unauthorised use, circulation, copying or disclosure of any part of this communication may be unlawful. (c) May be susceptible to interference, and should not be assumed that it has come in its original form and/or from the stated sender or PinkRoccade UK accepts no responsibility for information, errors or omissions in this e-mail or use or misuse thereof or any act done or omitted to be done in connection with this communication. If you are not the intended recipient, please inform postmaster@xxxxxxxxxxxxxxxxx immediately and delete it and all copies from your system. www.pinkroccade.co.uk **********************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.