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 2015/07/21 14:58:19 UTC

[Bug 58146] Unable to simply create Theme in new XSSFWorkbook

https://bz.apache.org/bugzilla/show_bug.cgi?id=58146

--- Comment #1 from Piotr <ma...@tlen.pl> ---
After some days I can create new Theme without reading anything from external
file. I can create two entries in files content_types.xml and
/xl/_rels/workbook.xml.rels:
    XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
    POIXMLDocumentPart docThemePart =
xssfWorkbook.createRelationship(XSSFRelation.THEME, XSSFFactory.getInstance(),
1);
Normally it’s not possible in ApachePOI, because it causes error. I had to
MODIFY(!) ApachePOI ThemesTable class - I added constructor:
    public ThemesTable() { super(); }
Then function above creates file /xl/theme/theme1.xml too, but it’s empty. How
to fill this file? If I get Theme
    ThemesTable theme = (ThemesTable) docThemePart;
and change it, content is not wrote to theme.xml. How to fill this file?
I checked Zip creating. Method marshall() in ZipPartMarshaller class gets input
stream from some workbook parts. And for Theme input stream is empty. Maybe
that’s the problem? When I tried (for tests) to create other object:
    xssfWorkbook.createRelationship(XSSFRelation.CHART,
XSSFFactory.getInstance());
everything was good.

-- 
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