You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/04/02 04:19:48 UTC
[Bug 56295] Cell styles are not copied from one workbook to another
https://issues.apache.org/bugzilla/show_bug.cgi?id=56295
--- Comment #5 from nestor.urquiza@gmail.com ---
Nick thanks for the suggestion. I chenged the below in
XlsxSheetCopyUtil#copyCell:
//newCell.setCellStyle(newCellStyle);
newCell.getCellStyle().cloneStyleFrom(newCellStyle);
However I got the failure below even though files and code are Excel 2013
compatible as far as I understand:
There was 1 failure:
1) testMergeXlslsWithStyles(XlsxSheetCopyUtilTest)
java.lang.IllegalArgumentException: Can only clone from one XSSFCellStyle to
another, not between HSSFCellStyle and XSSFCellStyle
at
org.apache.poi.xssf.usermodel.XSSFCellStyle.cloneStyleFrom(XSSFCellStyle.java:186)
at XlsxSheetCopyUtil.copyCell(XlsxSheetCopyUtil.java:113)
at XlsxSheetCopyUtil.copyRow(XlsxSheetCopyUtil.java:80)
at XlsxSheetCopyUtil.copySheets(XlsxSheetCopyUtil.java:49)
at XlsxSheetCopyUtil.copySheets(XlsxSheetCopyUtil.java:34)
at
XlsxSheetCopyUtilTest.testMergeXlslsWithStyles(XlsxSheetCopyUtilTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:96)
at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:47)
at org.junit.runner.JUnitCore.main(JUnitCore.java:40)
There is no reference to HSSF at all as you can see:
Nestors-MacBook-Pro:xlsx-xslm-style-lost-on-merge nu$ find ./ -name "*.java"
.//CellRangeAddressWrapper.java
.//XlsxSheetCopyUtil.java
.//XlsxSheetCopyUtilTest.java
Nestors-MacBook-Pro:xlsx-xslm-style-lost-on-merge nu$ find ./ -name
"*.java"|xargs grep HSSF
Nestors-MacBook-Pro:xlsx-xslm-style-lost-on-merge nu$
Any ideas?
Thanks!
- Nestor
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org