QXlsx icon indicating copy to clipboard operation
QXlsx copied to clipboard

Read data in excel2016 and receive accuracy loss with QString type. Test data 0.0524 accuracy loss when reading

Open lululuhaha opened this issue 1 year ago • 2 comments

When reading data in excel, I read the value of 0.0524. No matter what format is set in excel, the data obtained is 5.2400000000000002E-2. the code is : QXlsx::Document xlsx("book1.xlsx"); xlsx.selectSheet("test"); qDebug()<<xlsx.read(1,3);

lululuhaha avatar May 29 '23 06:05 lululuhaha

read读过来是一个QVarient,使用to_double() 方法即可转换为double数据

bruce18887 avatar Aug 21 '23 01:08 bruce18887

@ lululuhaha This is a problem with excel, when you open the file for example with 7-zip, you can see in the main xml-sheet, that excel is saving the numbers in maximum 64-bit precision, and sometimes exponential, I don't know why.

psynetic avatar Oct 15 '23 10:10 psynetic