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/03/06 06:36:15 UTC
Read predefined styles in xwpf
Hi,
How can i read ms word predefined styles using xwpf? (e.g heading styles).
I can read after i have used the particular style in my document. But i need
to read all predefined heading styles whether i am using it or not in my
word document.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-predefined-styles-in-xwpf-tp5715095.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: Read predefined styles in xwpf
Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 6 Mar 2014, Perundevi wrote:
> No, not there.
OK, if the data isn't in the file, then there's no way for POI to read it
out and give it to you
What we do have in some other places is a constants file, which contains
the various built-in (and hence not stored in the file) values. Any chance
you could identify what the built in formats are, I guess by something
like using them in a simple way, then post that to a new bug in bugzilla
pending creation of such a built-ins list?
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Read predefined styles in xwpf
Posted by Perundevi <as...@gmail.com>.
No, not there.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-predefined-styles-in-xwpf-tp5715095p5715103.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: Read predefined styles in xwpf
Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 6 Mar 2014, Perundevi wrote:
> If you open the ms word blank document, you can see, there are some
> style in style gallery like normal,No spacing, Heading1, Heading2 etc.,
Do these get saved into the file though? i.e. if you create a blank file,
save it, and then check the xml by hand, are they in there?
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Read predefined styles in xwpf
Posted by Perundevi <as...@gmail.com>.
If you open the ms word blank document, you can see, there are some style in
style gallery like normal,No spacing, Heading1, Heading2 etc.,
So they have some predefined styles. I need to get that styles by using poi
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-predefined-styles-in-xwpf-tp5715095p5715101.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: Read predefined styles in xwpf
Posted by Perundevi <as...@gmail.com>.
no, it is with the same name. I have a document with one paragraph and that
paragraph is in normal style.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-predefined-styles-in-xwpf-tp5715095p5715100.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: Read predefined styles in xwpf
Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 6 Mar 2014, Perundevi wrote:
> If i use any styles within the word document other than normal, then i can
> get the xwpfstyle from the xwpfdocument. Otherwise i can't get, it returns
> null. I am using the following code,
>
> XWPFStyle style = document.getStyles().getStyle("Heading1");
What if you enumerate all the defined styles, is it there with another
name?
> so i need to predefined styles for word document. can u tell me how can
> i get this?
POI will only give you the values stored in the document. If something
isn't there, we can't return it
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Read predefined styles in xwpf
Posted by Perundevi <as...@gmail.com>.
If i use any styles within the word document other than normal, then i can
get the xwpfstyle from the xwpfdocument. Otherwise i can't get, it returns
null. I am using the following code,
XWPFStyle style = document.getStyles().getStyle("Heading1");
There is no separate paragraph with heading1 style in my document. so it
returns null.
so i need to predefined styles for word document. can u tell me how can i
get this?
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Read-predefined-styles-in-xwpf-tp5715095p5715098.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: Read predefined styles in xwpf
Posted by Nick Burch <ap...@gagravarr.org>.
On Wed, 5 Mar 2014, Perundevi wrote:
> How can i read ms word predefined styles using xwpf? (e.g heading
> styles).
Can you not get the information you need from the XWPFStyles object from
XWPFDocument?
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org