Page 1 of 1

Convert ParaRPR to RPr

PostPosted: Thu Apr 21, 2011 12:18 am
by freemink
Hi,

I'm creating a Run and need to inherit the formatting from the enclosing Paragraph. I can see that I need to get the ParaRPr (para.getRPr()) and set in the new run (run.setRpr()). But I can't see an easy way to convert the ParaRPr to a RPr.

Is there an easy way to do this? Am I going about get the style the wrong way?

Many thanks....

Re: Convert ParaRPR to RPr

PostPosted: Thu Apr 21, 2011 1:16 am
by jason
svn contains a contributed class org.docx4j.model.styles.StyleUtil, which has a method:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
public static RPr apply(ParaRPr source, RPr destination)
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


docx4j 2.6.0 contains org.docx4j.model.PropertyResolver:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
protected void applyRPr(ParaRPr rPrToApply, RPr effectiveRPr)
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


(Clearly there is a bit of overlap here..)

Re: Convert ParaRPR to RPr

PostPosted: Thu Apr 21, 2011 1:30 am
by freemink
Just what I was looking for!

I'll try PropertyResolver first as it's in the jar and looks like it should do the job.

Thanks again.