Heading Style not recognized in Word 2007
Posted: Fri Nov 26, 2010 12:41 am
Hi,
I am trying to create a document and want to use different styles for my headings so I can easily generate a table of contents in the end.
Using following code, I try to generate a paragraph, using the "Heading1" style.
This adds the paragraph and the text to my document.
However, in OpenOffice3 the heading 1 is recognized, the table of contents is there and everything works fine. In Word 2007, the style is simply not recognized by word, so no table of contents and the default style on my text.
I get the style by name from
Out of that map, I use the style with the Key "Heading1".
Any help is greatly appreciated.
-- artur
I am trying to create a document and want to use different styles for my headings so I can easily generate a table of contents in the end.
Using following code, I try to generate a paragraph, using the "Heading1" style.
- Code: Select all
P paragraph = parent.getMainDocumentPart().addParagraphOfText( text );
PPr paragraphProperties = objFactory.createPPr();
PStyle pStyle = new PStyle();
pStyle.setVal( style.getStyle().getStyleId() );
paragraphProperties.setPStyle( pStyle );
paragraph.setPPr( paragraphProperties );
This adds the paragraph and the text to my document.
However, in OpenOffice3 the heading 1 is recognized, the table of contents is there and everything works fine. In Word 2007, the style is simply not recognized by word, so no table of contents and the default style on my text.
I get the style by name from
- Code: Select all
StyleDefinitionsPart.getKnownStyles()
Out of that map, I use the style with the Key "Heading1".
Any help is greatly appreciated.
-- artur