Hi Rainer,
             Actuall by saying style i wanted to say style of
character/paragraph , i.e if I open a document in ms word it shows just
beside font name like... normal, heading 1, heading 2....... etc .... When I
parse one do file following code gives  me style...... I think by seeing
this you'll understand what I want
<code>
Paragraph p = s.getParagraph(y);
StyleSheet styleSheet = doc.getStyleSheet();
          for (int z = 0; z < p.numCharacterRuns(); z++)
          {
            //character run
                  StyleDescription paragraphStyle =
                           styleSheet.getStyleDescription(p.getStyleIndex());
                                        String styleName = 
paragraphStyle.getName(); 
            CharacterRun run = p.getCharacterRun(z);
            //character run text
            CharacterProperties prop = run.cloneProperties();
            System.out.println(styleName)
</code>
this stylename I want to set ...... Please tell me is there any way out??
Thanks in advence.
                                                                                
                                
Best regards, turja 





Rainer Schwarze wrote:
> 
> At 10:34 01.03.2007, turjabarua wrote:
>>Hi all,
>>        I am quite new to HWPF. I want to create a word doc where
>>characters/paragraph will be written in specific style. So i need to know
>>how can I set style while creating a word doc using HWPF. Can anybody help
>>me??
>>turja
> 
> Hi Turja,
> 
> you probably insert text and/or paragraphs using a Range instance. There
> are those insertBefore / insertAfter methods which in addition to the text
> String take a CharacterProperties instance. The CharacterProperties
> instance is the thing you need to take care of for formatting. For
> paragraphs you look for ParagraphProperties. If you need more details,
> just
> ask :-)
> 
> (My usual warning for HWPF: You may get along while staying with very
> simple documents. If you use fields, headers/footers, etc. you should
> expect that your generated files are invalid and Word crashes on them.)
> 
> Best wishes, Rainer
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Need-to-set-style-of-a-character-paragraph-using-HWPF-tf3325890.html#a9247395
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to