Sigh. Well I think I found something - but of course I cannot get my old version of Excel to complain. In the file workbook.cpp, at the bottom, there is a big if statement with references to WB_CONTINUE_REC. Comment that whole if statement out, and try again. This will almost for sure fix your problem. Why it wasn't flagged earlier is baffling. Obviously let me know what happens.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if there is 32832 records
ALREADY=0 dataSize=8224 MAX=8224 dumpState=2. m_ContinueIndex=0
if there is 32833 records
ALREADY=0 dataSize=8228 MAX=8224 dumpState=2. m_ContinueIndex=0
Comment the whole if statement out, doesn't fix any thing,
and another warning from Excel says this file has some problem.
// if(m_pCurrentData != NULL) {
// // SST Table most likely record to exceed size, but its handled now in the record itself (breaks have to occur at defined places)
// // Should only happen with single cells having data > MAX_RECORD_SIZE. Have no idea if this works or not (DFH)
// if(!((CRecord*)m_pCurrentData)->AlreadyContinued() && ((CRecord*)m_pCurrentData)->GetRecordDataSize() > MAX_RECORD_SIZE && m_DumpState !=
// WB_CONTINUE_REC) {
// // Save the current dump state and change to the CONTINUE Record state
// CHANGE_DUMPSTATE(WB_CONTINUE_REC);
// //printf("ALREADY=%d dataSize=%lu MAX=%d (dumpState == CONTINUE) = %d\n", ((CRecord*)m_pCurrentData)->AlreadyContinued(), ((CRecord*)m_pCurrentData)->GetRecordDataSize(), MAX_RECORD_SIZE ,m_DumpState == WB_CONTINUE_REC);
//
// m_ContinueIndex = 0;
//
// repeat = true;
// }
// }
I took one of your older files/source - one with just one more row to cause your issue, and created one on my mac. I then "disassembled" them using libXls (which reads excel files). They both look identical. I did see this continue record appearing in files with the problem size, but not in the one that's just one row less.
OK - another task for you. Create a file that has 32832 rows in it - start at 0 - and put the row number in it. Open that file in Excel, and add one more row at the bottom - to create the problematic size. Save it as an xls file. Send that to me along with the exact code you use. I will then disassemble that "good" file and see what Excel does differently than xlsLib.
My old 2007 version of Excel running on an old Mac opens all of your files just fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can open all my file with LibreOffice Calc base on Ubuntu without any warning, but Excel doesn't think so.
Thresh_OK_32832.xls
Code creat wtih 32832 rows, no warning
Thresh_OK_32832+1byExcel.xls
Add 1 row at the button of file by Excel, total rows 32833, no warning
Thresh_Err_32833.xls
Code creat wtih 32833 rows, Warning!
exact code I use:
#include<stdio.h>#include"xlslib/xlslib.h"usingnamespacestd;usingnamespacexlslib_core;intmain(intargc,char*argv[]){workbookwb;worksheet*sh=wb.sheet("Test1");unsignedintrow_total=32832;//<=32832 is OK; >32832 will file validation failurefor(unsignedintiRow=0;iRow<row_total;iRow++){sh->number(iRow,0,1.0);}wb.Dump("Thresh.xls");return(0);}
Excel adds so much new records to the file its almost impossible to read - but in any case it did not add any continue records - so the first commentting that I told you to do is in the right direction. I found this in sheetrec.cpp - its more code to deal with the CONTINUE record that probably isn't needed - try commenting it out too:
Sigh. Well I think I found something - but of course I cannot get my old version of Excel to complain. In the file workbook.cpp, at the bottom, there is a big if statement with references to WB_CONTINUE_REC. Comment that whole if statement out, and try again. This will almost for sure fix your problem. Why it wasn't flagged earlier is baffling. Obviously let me know what happens.
if there is 32832 records
ALREADY=0 dataSize=8224 MAX=8224 dumpState=2. m_ContinueIndex=0
if there is 32833 records
ALREADY=0 dataSize=8228 MAX=8224 dumpState=2. m_ContinueIndex=0
Comment the whole if statement out, doesn't fix any thing,
and another warning from Excel says this file has some problem.
I took one of your older files/source - one with just one more row to cause your issue, and created one on my mac. I then "disassembled" them using libXls (which reads excel files). They both look identical. I did see this continue record appearing in files with the problem size, but not in the one that's just one row less.
OK - another task for you. Create a file that has 32832 rows in it - start at 0 - and put the row number in it. Open that file in Excel, and add one more row at the bottom - to create the problematic size. Save it as an xls file. Send that to me along with the exact code you use. I will then disassemble that "good" file and see what Excel does differently than xlsLib.
My old 2007 version of Excel running on an old Mac opens all of your files just fine.
I can open all my file with LibreOffice Calc base on Ubuntu without any warning, but Excel doesn't think so.
Thresh_OK_32832.xls
Code creat wtih 32832 rows, no warning
Thresh_OK_32832+1byExcel.xls
Add 1 row at the button of file by Excel, total rows 32833, no warning
Thresh_Err_32833.xls
Code creat wtih 32833 rows, Warning!
exact code I use:
Excel adds so much new records to the file its almost impossible to read - but in any case it did not add any continue records - so the first commentting that I told you to do is in the right direction. I found this in sheetrec.cpp - its more code to deal with the CONTINUE record that probably isn't needed - try commenting it out too:
Probably this one too:
This was original code I got 10 years ago.
I meet the same problem. I comment the code suggested by David, but it did not fix the problem.
I build this lib with vs2010 on windows