Submitted https://bz.apache.org/bugzilla/show_bug.cgi?id=69688
On Tue, May 13, 2025 at 12:26 PM PJ Fanning <fannin...@gmail.com> wrote: > Please raise a bug in bugzilla. POI is a volunteer project and I am > currently busy and don't have a lot of time to devote to unpaid work. > > On Tue, 13 May 2025 at 15:41, Dan S <dsti...@gmail.com> wrote: > > > > PJ, > > I am trying to use the copyRows as you suggested but I am hitting some > exceptions regarding formulas even though my data has no formulas. I took a > unit test of mine in which I was testing the bug I reported in > https://bz.apache.org/bugzilla/show_bug.cgi?id=69583 and refitted it with > an HSSFWorkbook along with my code which creates a new Workbook from each > Sheet of an existing Workbook. The unit code test is included as an > attachment. The stacktrace I get is: > > > > [main] WARN org.apache.poi.POIDocument - DocumentSummaryInformation > property set came back as null > > [main] WARN org.apache.poi.POIDocument - SummaryInformation property set > came back as null > > > > java.lang.IllegalStateException: Cannot get a FORMULA value from a > STRING formula cell > > > > at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:648) > > at > org.apache.poi.hssf.usermodel.HSSFCell.getCellFormula(HSSFCell.java:640) > > at > org.apache.poi.hssf.usermodel.helpers.HSSFRowColShifter.updateRowFormulas(HSSFRowColShifter.java:74) > > at > org.apache.poi.hssf.usermodel.helpers.HSSFRowShifter.updateRowFormulas(HSSFRowShifter.java:71) > > at org.apache.poi.hssf.usermodel.HSSFRow.copyRowFrom(HSSFRow.java:853) > > at > org.apache.nifi.excel.TestHSSFRowCopyRowFrom.test(TestHSSFRowCopyRowFrom.java:74) > > at java.base/java.lang.reflect.Method.invoke(Method.java:580) > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) > > at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) > > > > > > > > On Mon, May 12, 2025 at 6:32 PM Dan S <dsti...@gmail.com> wrote: > >> > >> PJ, > >> Thank you! That is very helpful and aligns very well with the XSSFSheet > copyRows method in regards to use of CellCopyPolicy and CellCopyContext. > >> > >> On Mon, May 12, 2025 at 5:49 PM PJ Fanning <fannin...@apache.org> > wrote: > >>> > >>> There is copyRowFrom in HSSFRow. > >>> > >>> > https://poi.apache.org/apidocs/dev/org/apache/poi/hssf/usermodel/HSSFRow.html#copyRowFrom-org.apache.poi.ss.usermodel.Row-org.apache.poi.ss.usermodel.CellCopyPolicy-org.apache.poi.ss.usermodel.CellCopyContext- > >>> > >>> On Mon, 12 May 2025 at 21:54, Dan S <dsti...@gmail.com> wrote: > >>> > > >>> > XSSFSheet has a copyRows method which allows for copying the > contents of > >>> > one XSSFSheet to another one. I do not see an equivalent method for > an > >>> > HSSFSheet. I see from this post > >>> > < > https://lists.apache.org/list?user@poi.apache.org:dfr=2020-1-1|dto=2025-5-12:HSSFSheet%20copy > <https://lists.apache.org/list?user@poi.apache.org:dfr=2020-1-1%7Cdto=2025-5-12:HSSFSheet%20copy> > > > >>> > a solution which allows copying for HSSFSheet and XSSFSheet. I just > want to > >>> > make sure if that is a recommended way for HSSF and if not has there > been > >>> > any change to POI that provides methods for this? > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > >>> For additional commands, e-mail: user-h...@poi.apache.org > >>> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > > For additional commands, e-mail: user-h...@poi.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > For additional commands, e-mail: user-h...@poi.apache.org > >