Page 1 of 1

Adding Themes to Excel

PostPosted: Tue Jun 14, 2016 10:37 pm
by vamsi_mohan13
I want to preserve a themespart that is derived as a result of converting content from .docx file to .xlsx.
However, there is no support in org.docx4j.openpackaging.parts.relationships.Namespaces.java to add a themepart in xlsx package.
the theme partname is /xl/themes/theme1.xml
What is the best way out here without changing the core module?

Re: Adding Themes to Excel

PostPosted: Wed Jun 15, 2016 9:02 pm
by jason
ThemePart is https://github.com/plutext/docx4j/blob/ ... ePart.java

Use the constructor which lets you pass a PartName arg

You need to add the theme to the workbook:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
pkg.getWorkbookPart().addTargetPart(yourThemePart)
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


addTargetPart is the standard way of attaching a part to the part that method is called on