https://issues.apache.org/bugzilla/show_bug.cgi?id=45404

           Summary: [PATCH] New class to obtain formatted cell values
           Product: POI
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


HSSFDataFormatter contains methods for formatting the value stored in an
HSSFCell. This can be useful for reports and GUI presentations when you need to
display data exactly as it appears in Excel. Supported formats include
currency, SSN, percentages, decimals, dates, phone numbers, zip codes, etc. 


Usage:

HSSFCell cell = row.getCell(0);
HSSFDataFormatter fomatter = new HSSFDataFormatter();
String formattedStr = formatter.formatCellValue(cell);

-This yields a formatted string based on the cell type & format:
-CELL_TYPE_STRING = returns string value as is
-CELL_TYPE_BOOLEAN = returns "true" or "false"
-CELL_TYPE_BLANK = returns ""
-CELL_TYPE_FORMULA = cell formula string
-CELL_TYPE_NUMERIC = formatted value i.e. "$1,000.00 USD", "61.54%", "Thursday,
January 02, 2003"

-There's also an overloaded method that takes a FormulaEvaluator:

String formattedStr = formatter.formatCellValue(cell, evaluator);

-CELL_TYPE_FORMULA = cell formula is evaluated, then formatted
-All other cell types = same as above


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

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

Reply via email to