incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Cunningham (JIRA)" <>
Subject [jira] [Created] (ODFTOOLKIT-372) Simple API not setting heading style
Date Sun, 25 Aug 2013 11:18:51 GMT
Ian Cunningham created ODFTOOLKIT-372:

             Summary: Simple API not setting heading style
                 Key: ODFTOOLKIT-372
             Project: ODF Toolkit
          Issue Type: Bug
          Components: simple api
    Affects Versions: 0.7-incubating
            Reporter: Ian Cunningham

I created the following test in response to a recent email

public class TextPropertiesTest { ...

	public void testTextGetSetName() {
		try {
			TextDocument document = TextDocument.newTextDocument();
			Paragraph firstPara = document.getParagraphByIndex(0, false);
			firstPara.setTextContent("I am alive and should be a heading");

			String styleName = firstPara.getStyleName();
			Assert.assertEquals("Heading_20_1", styleName);
			TextDocument loadedDocument =  TextDocument.loadDocument(ResourceUtilities.newTestOutputFile("testGetSetStyleName.odt"));
			Paragraph loadedFirstPara = loadedDocument.getParagraphByIndex(0, false);
			String loadedStyleName = loadedFirstPara.getStyleName();
			Assert.assertEquals("Heading_20_1", loadedStyleName);
		} catch (Exception e) {
			LOGGER.log(Level.SEVERE, e.getMessage(), e);;

The Style Name returned is an empty string. 

But I don't really understand the design well enough to figure out a solution.... just yet.
I can see the style is left at Standard 
      <text:h text:outline-level="1" text:style-name="Standard">I am alive and should
be a heading</text:h>

A work around is to get the underlying ODFElement and change its style. But that kind of defeats
the purpose of the API?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message