Bug 65245 - In Excel97-2003(xls), [¥300] is incorrectly output as [$300]
Summary: In Excel97-2003(xls), [¥300] is incorrectly output as [$300]
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 5.0.0-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-16 03:09 UTC by Yin WeiLi
Modified: 2021-04-28 14:04 UTC (History)
0 users



Attachments
sample code (6.04 KB, application/x-zip-compressed)
2021-04-16 03:09 UTC, Yin WeiLi
Details
sample code2 (6.08 KB, application/vnd.rar)
2021-04-28 08:15 UTC, Yin WeiLi
Details
test results (113.71 KB, image/png)
2021-04-28 08:16 UTC, Yin WeiLi
Details

Note You need to log in before you can comment on or make changes to this bug.
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.