DO NOT REPLY [Bug 42630] New: - Excel : isInternalDateFormat

2007-06-11 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=42630.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42630

   Summary: Excel :  isInternalDateFormat
   Product: POI
   Version: unspecified
  Platform: Other
OS/Version: other
Status: NEW
  Severity: normal
  Priority: P1
 Component: HSSF
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


I am using Microsoft excel 2003. I have a date formated cell in the
sheet(14/06/1941 ENGLISH UK format). When i debugged the value of the
HSSFCellStyle.getDataFormat is 198 . But in the method isInternalDateFormat it
fails. But if i add 198 to the check list, it succeeds.

 /**
  * given a format ID this will check whether the format represents
  * an internal date format or not. 
  */
 public static boolean isInternalDateFormat(int format) {
   boolean retval =false;

 switch(format) {
 // Internal Date Formats as described on page 427 in
 // Microsoft Excel Dev's Kit...
 case 0x0e:
 case 0x0f:
 case 0x10:
 case 0x11:
 case 0x12:
 case 0x13:
 case 0x14:
 case 0x15:
 case 0x16:
 case 0x2d:
 case 0x2e:
 case 0x2f:
 case 198:
 retval = true;
 break;
 
 default:
 retval = false;
 break;
 }
return retval;
 }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 42630] - Excel : isInternalDateFormat

2007-06-11 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
http://issues.apache.org/bugzilla/show_bug.cgi?id=42630.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42630


[EMAIL PROTECTED] changed:

   What|Removed |Added

   Severity|normal  |critical




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Unable to read an excel file

2007-06-11 Thread Rainer Schwarze
Hello Nick,

I looked into the file of Sascha and noticed the following issues:

1) The file format doesn't seem to be a perfect excel format (see below)

2) Supporting such files in HSSF requires small changes to several
(maybe a lot) of the *Record classes fillFields method and identifying a
few situations where the file format is not fully understood. (not sure,
if more is needed)

The details:

The BOF record of the file has the ID 0x0809 indicating BIFF8, however
the length of the BOF-record is 6 which matches the specs for IDs 0x0209
or 0x0409 which in turn would mean BIFF2..BIFF4.

So the primary reason for HSSF to fail on that file is that HSSF expects
proper record length, but most records in the file (as far as I looked)
are too short. Which leads to the typical changes of the code: For
instance while trying to track down the problem, I changed
BOFRecord.fillFields

from:

protected void fillFields(RecordInputStream in)
{
field_1_version  = in.readShort();
field_2_type = in.readShort();
field_3_build= in.readShort();
field_4_year = in.readShort();
field_5_history  = in.readInt();
field_6_rversion = in.readInt();
}

to:

protected void fillFields(RecordInputStream in)
{
field_1_version  = in.readShort();
field_2_type = in.readShort();
if (in.getRecordOffset()in.getLength())
   field_3_build= in.readShort();
if (in.getRecordOffset()in.getLength())
   field_4_year = in.readShort();
if (in.getRecordOffset()in.getLength())
   field_5_history  = in.readInt();
if (in.getRecordOffset()in.getLength())
   field_6_rversion = in.readInt();
}

That worked somewhat for BOF, DIMENSIONS and HEADER. However, for the
FOOTER record the changes are a bit more complicated, because there
seems to be no unicode flag in the file. The code contains:

field_2_reserved = in.readByte();
field_3_unicode_flag = in.readByte();   

These two fields do not exist in the excel file and my assumption is,
that the unicode_flag is only there, if the reserved field is zero. If
it is non-zero, it is already the first character of the string.
At that point I stopped digging deeper in order to discuss a few things
before potentially wasting time.

Regarding the file itself: Would it be an option to submit a bug and
attach the file to it?

What do you (or others) think about this? Could there be a solution just
around the corner which I don't see? (Maybe someone is already working
on that kind of situation?)

Best wishes,
Rainer

Sascha Schäfer wrote:
 Hello again,
 
 I saw, that the attachment was deleted. Maybe I can send this file to your
 personal email because I have no webspace. If not, I would look for a forum,
 which allowed me to post my file.
 
 Thanks,
 Sascha
[...]
 -Ursprüngliche Nachricht-
 Von: Nick Burch [mailto:[EMAIL PROTECTED] 
 Gesendet: Montag, 4. Juni 2007 12:34
 An: POI Users List
 Betreff: Re: AW: Unable to read an excel file
 
 On Fri, 1 Jun 2007, Sascha Schäfer wrote:
 I also tried to save this file with the save as option. I selected the 
 actual excel-format, which was also preselected. After that, I was able 
 to read this file with jakarata poi.
 
 If you post the file somewhere, I'll take a look and see if I can spot 
 anything obviously wrong with it.
 
 Nick

-- 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



POI Visio?

2007-06-11 Thread Dmitry Goldenberg
Hello,

Sorry for the wide distribution.

I was wondering if there are any capabilities, either already in POI or being 
planned for, to have a Java API for the Visio file format.  Also, is there 
anywhere an open source Java converter from the native Visio format to XML?

Any info would be appreciated.

Thanks,
- Dmitry