简体   繁体   中英

xlsx analysis:where XMLvalue is different from cells value

now we've building a function that import a large xlsx files (more than 200MB) to DB,using apache.poi and go through all the xml files reading for that data.

that function had completed but have a questuion:

when I input a value '1:16' in a xlsx cell,it would auto covery store type to 'user-defined-numeric'

in xml file you'll see <cr="A1" s="1"><v>5.2777777777777778E-2</v></c> and i just need get that value '1:16'

how can i do?

The "number" 1:16 is converted by Excel to a time and date/times in excel are stored as a number where the integer part is the number of days since the epoch and the decimal part is the percentage of the day.

So in your example:

= 0.0527777777777778 *24 *60 (hours * minutes)
= 76 mins
= 1 hour 16 mins

With POI you will need to use a data formatter . Something like:

DataFormatter formatter = new DataFormatter(Locale.US);

if(DateUtil.isCellDateFormatted(cell)) {
    String formattedData = formatter.formatCellValue(cell);
    ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM