Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

create Theme in new XSSFWorkbook

$
0
0
Is it is possible to create empty Theme if I create XSSFWorkbook by constructor XSSFWorkbook()?
I tried to do this, but there is a lot of fields (like Relations) to fill when I create Theme - and finally I have to do something like reading inputStream. But I don’t have IS, because I want create new workbook and fill everything using data from external JSON file.
Creating Theme is so complicated, so I tried to do this in some other ways too:
1) I tried to: import empty XLSX file to ApachePOI, get Theme from it and set this Theme to my new XSSFWorkbook. But then my new XLSX file doesn’t have file /xl/theme/theme1.xmland informations:
Code:

<Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme1.xml" />
in content_types.xml,
Code:

<Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme1.xml" />
in /xl/_rels/workbook.xml.rels.
2) Then I tried to not create new XSSFWorkbook, but: import external XLSX file, change its Theme and save again as XLSX. Then file has informations about Theme, but about original - not changed.
I checked that constructor XSSFWorkbook() creates objects like StylesSource and SharedStringsTable, but not ThemesTable. So maybe it’ impossible to change Theme after constructor, because in fact it changes nothing?
Any suggestions? Please, help, I’ve been trying for 3 days.

Viewing all articles
Browse latest Browse all 120

Latest Images

Trending Articles



Latest Images