Bug 49370 - Can't save out .xlsx with conditional formatting.
Summary: Can't save out .xlsx with conditional formatting.
Status: RESOLVED LATER
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.6-FINAL
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-01 16:14 UTC by will
Modified: 2010-06-02 12:03 UTC (History)
1 user (show)



Attachments
xlsx that shows the issue. (9.39 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2010-06-01 16:14 UTC, will
Details

Note You need to log in before you can comment on or make changes to this bug.
Description will 2010-06-01 16:14:25 UTC
Created attachment 25507 [details]
xlsx that shows the issue.

Similar to ticket 48494

Given the following snippet in a J2EE app, using POI 3.6 20091214:

String realPath = getServletContext().getRealPath("/WEB-INF/Book1.xlsx");
    InputStream inp = new FileInputStream(realPath);
    Workbook wb = WorkbookFactory.create(inp);
    
    wb.createSheet("new sheet");

    // Write the output to a file
     realPath = getServletContext().getRealPath("/WEB-INF/Book1_out.xlsx");
    FileOutputStream fileOut = new FileOutputStream(realPath);
    wb.write(fileOut);
    fileOut.close();


this dies on the .write() call with:


javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTDxfs$1
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
	org.apache.jsp.About_jsp._jspService(About_jsp.java:112)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

commenting out the .createSheet() avoids the error, avoiding conditional formatting avoids the error. (Cell E1 contains the conditional formatting in the attachment.)
Comment 1 Nick Burch 2010-06-01 16:29:38 UTC
This sort of issue has been discussed a large number of times in bugs and on the mailing lists....

Short term, you'll need to use the full ooxml schemas jar, not the minimal one

Longer term, please submit a new unit test that uses the extra ooxml classes that you need, so that our build script which identifies only the bits of the full ooxml jar that are routinely used can pick it up and include it in the next version
Comment 2 will 2010-06-01 17:07:55 UTC
(In reply to comment #1)
> This sort of issue has been discussed a large number of times in bugs and on
> the mailing lists....

For those who end up finding /this/ bug when searching ...
 
> Short term, you'll need to use the full ooxml schemas jar, not the minimal one

And this is described here:

https://issues.apache.org/bugzilla/show_bug.cgi?id=49325

specifically:

>> As a workaround, replacing poi-ooxml-schemas-3.6-20091214.jar with
>> ooxml-schemas-1.0.jar downloaded from
>> http://mirrors.ibiblio.org/pub/mirrors/maven2//org/apache/poi/ooxml-schemas/1.0/
>> resolved the issue.

> Longer term, please submit a new unit test that uses the extra ooxml classes
> that you need, so that our build script which identifies only the bits of the
> full ooxml jar that are routinely used can pick it up and include it in the
> next version
Comment 3 Nick Burch 2010-06-02 12:03:43 UTC
http://poi.apache.org/faq.html#faq-N10025 also covers this too