You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Perundevi <as...@gmail.com> on 2014/01/23 07:06:13 UTC

xwpfdocument default style

Hi,

I am using POI 3.9. I want to create a word document using xwpf. 

I need to know, how to create document's default styles, like run style,
para style, default font etc.,

I am using the following code,

if( document.getStyles() == null) {
     XWPFStyles styles = document.createStyles();
}

CTDocDefaults def = document.getStyle().addNewDocDefaults();

The above line throws the exception like "Expecting one Styles document
part, but found".

how to clear this? please do the needful.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xwpfdocument-default-style-tp5714728.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: xwpfdocument default style

Posted by Nick Burch <ap...@gagravarr.org>.
On Wed, 22 Jan 2014, Perundevi wrote:
> I am using POI 3.9. I want to create a word document using xwpf.

Have you tried a recent nightly build? Otherwise, I'd suggest you hang on 
about a week and re-try with 3.10 final when that's out

> I need to know, how to create document's default styles, like run style,
> para style, default font etc.,
>
> I am using the following code,
>
> if( document.getStyles() == null) {
>     XWPFStyles styles = document.createStyles();
> }
>
> CTDocDefaults def = document.getStyle().addNewDocDefaults();
>
> The above line throws the exception like "Expecting one Styles document
> part, but found".

If the problem isn't fixed in the current codebase, your best bet is to 
write a very small junit unit test that shows the problem, and then raise 
a bug in bugzilla for it

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org