Bug 65245

Summary: In Excel97-2003(xls), [¥300] is incorrectly output as [$300]
Product: POI Reporter: Yin WeiLi <wlyin>
Component: HSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 5.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: sample code
sample code2
test results

Description Yin WeiLi 2021-04-16 03:09:12 UTC
Created attachment 37810 [details]
sample code

In detail,
According to the suffix of Excel file, [apache tika] will automatically read the contents of the Excel file.

callStacks:
    org\apache\tika\parser\microsoft\OfficeParser.#parse
    org\apache\tika\parser\microsoft\TikaHSSFListener#parse
    org\apache\tika\parser\microsoft\TikaHSSFListener#processFile
    poi-5.0.0.jar!\org\apache\poi\hssf\eventusermodel\HSSFEventFactory.class#processEvents
    poi-5.0.0.jar!\org\apache\poi\hssf\eventusermodel\HSSFEventFactory.class#genericProcessEvents
    poi-5.0.0.jar!\org\apache\poi\hssf\eventusermodel\HSSFRequest.class#processRecord
    poi-5.0.0.jar!\org\apache\poi\hssf\eventusermodel\FormatTrackingHSSFListener.classFormatTrackingHSSFListener#processRecord

In Excel97-2003(xls),
When [Format Cells > Number > Currency > Negative numbers]  is set to [¥-1,234] or [(RED)¥-1,234],
there will be a problem that [¥300] is read incorrectly as [$300].

The reason is that the Formatindex value of[¥- 1,234] and [(RED)¥-1,234] are [5] and [6], 
but the Formatindex values below 50 belong to [Custom] types.
The Formatindex and FormatString of [Custom] are as follows:
    5-->    "\"$\"#,##0_);(\"$\"#,##0)",
    6-->    "\"$\"#,##0_);[Red](\"$\"#,##0)",

Please refer to the attachment for sample code.
Comment 1 Dominik Stadler 2021-04-27 05:49:59 UTC
Can you try setting the user-local via LocalUtil.setUserLocale() to see if the local set locale affects this?
Comment 2 Yin WeiLi 2021-04-28 08:15:56 UTC
Created attachment 37838 [details]
sample code2
Comment 3 Yin WeiLi 2021-04-28 08:16:53 UTC
Created attachment 37839 [details]
test results
Comment 4 Yin WeiLi 2021-04-28 08:17:52 UTC
Thank you for your proposal.

I tried the method you mentioned, but it still doesn't work.

Please refer to the attachment [sample2] and [poi] for sample code.