Now that I understand what you are doing - getting a row from a sheet, changing it's index number and then populating cells on that row - I can say that I would have expected this to work.
So, I went away and did a few tests and it looks as though the setRowNum() method may not be working correctly. Firstly, I created an Excel file that had a single row - row 2 - and on that row one cell - cell A2 - was populated with data. Next, I write a simple program that opened this file using POI, created row 0 and populated cells A1 and B1 with data. Next, the program recovered row 2 from the sheet, created cell B2 and populated that with a formula. After wrting the file away to disk again, I tried to open it - using OpenOffice - and say that row 2 had not in fact been moved at all, the contents of cell B2 where still there. My next step was to unzip the xlsx file and take a look at the xml, the key part of which is below; <row r="11" spans="1:1" x14ac:dyDescent="0.25"> <c r="A2" t="s"><v>0</v></c> <c r="B11"><f>A1/B1</f></c> </row> which, as you can see shows row 11 and it contains the markup for two cells, cell A2 and B11. Seemingly, the call to setRowNum() did not actually change the indices for any cells that already existed on the row that was read from the file. I wonder if this is the problem you are seeing? The easy way to confirm this would be to unzip the xlsx file (this is much harder to do with an xls file) you are creating with poi and to look into the contents of the sheetn.xml files to see if the markup is similarly malformed. -- View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-write-the-Formula-of-division-with-2007-excel-files-and-POI-tp5528227p5547212.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
