poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fraser, Chip " <Chip.Fra...@tdsecurities.com>
Subject I would like to help a bit.
Date Fri, 25 Feb 2005 15:54:04 GMT
Hello,
 
I have used POI for some projects and would like to help a bit.
The biggest problem I have experienced is reading the correct data from
the sheets.
Specifically with dates and being able to read the graphic components
from the page
and return their values.
 
I think the graphics are done in the HSSFPatriarch class, I can
currently see only text field and
some shapes. Can anyone help me where to start. 
 
Chip
 
 
Here is some code to get the returning of dates working for some spread
sheets we have.
 
 public static boolean isCustomDateFormat(String format)
    {
       return 
               format.indexOf("m")>=0 ||
               format.indexOf("d") >=0 || 
               format.indexOf("y") >0 || 
               format.indexOf("h:")>=0 ||
               // format.indexOf(":m") >=0 || 
              format.indexOf(":s") >=0 || 
              format.indexOf("AM") >0 || 
              format.indexOf("PM") >0 ;
     
 
    }
    public  boolean isInternalDateFormat(short internalFormatIndex) {
        boolean retval = false;
 
        switch (internalFormatIndex) {
        // Internal Date Formats as described on page 427 in
        // Microsoft Excel Dev's Kit...
        case 0x0e: //   "m/d/yy",
        case 0x0f: // "d-mmm-yy"
        case 0x10: // "d-mmm"
        case 0x11: // "mmm-yy"
        case 0x12: // "h:mm AM/PM"
        case 0x13: // "h:mm:ss AM/PM"
        case 0x14: // "h:mm"
        case 0x15: // "h:mm:ss"
        case 0x16: // "m/d/yy h:mm"  or "dd/mm/yyyy hh:mm"
        case 0x2d: //"mm:ss"
        case 0x2e: // "[h]:mm:ss"
        case 0x2f: // "mm:ss.0"
            // Additional internal date formats found by inspection
 
            // Using Excel v.X 10
 
        case 0xa4:
        case 0xa5: //165:
        case 0xa6: //166
        case 0xa7: //167:
        case 0xa8: //168:
 
            ///??
        case 0xa9:
        case 0xaa:
        case 0xab:
        case 0xac:
        case 0xad:
            // ??
        case 0xae: //174:
        case 0xaf: //175:
        case 0xb0: //176:
            retval = true;
            break;
     
          
 
        default:
            if (internalFormatIndex >= 0xb2) {
                 // Custom
               String formatString =
formats.getFormat(internalFormatIndex);
               retval= isCustomDateFormat(formatString);
            }
            else
            {
                retval = false;
            }
            break;
        }
        return retval;
    }


-----------------------------------------------------------------------------------------
This e-mail and the information it contains may be legally privileged and/or confidential.

It is for the intended addressee(s) only. If you have received it in error, please do not

disclose the contents to anyone, but notify the sender immediately and delete the
transmission from your files. Except with the prior consent of the author, any distribution,

copying or editing of this information is prohibited and may be unlawful. E-mail transmission

cannot be guaranteed to be secure or error-free as the message and attachment ("the Information")
could be intercepted, corrupted, lost, destroyed, delayed, incomplete or contain viruses.
The 
sender and The Toronto-Dominion Bank or its subsidiaries ("TD Bank") do not accept liability

for any errors or omissions in the contents of the Information. The Information is not a 
solicitation or offer to buy or sell any investments, or a contract for any investment service.

Any opinions expressed in the Information are those of the individual sender, not TD Bank,
unless 
otherwise stated and where the sender is authorised to state them to be the opinions of TD
Bank. 
TD Bank will not enter into any form of contract by means of e-mail, and none of its representatives
is 
authorised to enter into contracts on behalf of TD Bank in this way. TD Bank reserves the
right 
to monitor all e-mail communications for the purposes of protecting the integrity of its electronic

systems and assessing compliance with applicable legal and regulatory requirements, and in-house

policies. The Toronto-Dominion Bank, TD Securities Limited and TD Bank Europe Limited are
authorised 
and regulated by the Financial Services Authority. TD Global Finance is regulated by the Irish

Financial Services Regulatory Authority. For important legal and regulatory information about

TD Bank, visit the legal pages of <http://www.td.com>. 
------------------------------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message