[
https://issues.apache.org/jira/browse/ODFTOOLKIT-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Florian Hopf updated ODFTOOLKIT-344:
------------------------------------
Affects Version/s: (was: simple-odfdom-0.7)
0.5-incubating
> NullPointerException in
> DefaultStyleHandler.getTextPropertiesForWrite().setFontColor()
> --------------------------------------------------------------------------------------
>
> Key: ODFTOOLKIT-344
> URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-344
> Project: ODF Toolkit
> Issue Type: Bug
> Components: simple api
> Affects Versions: 0.5-incubating
> Reporter: Marc Schreiber
>
> I'm trying to change to font color of a certain word in a Open Document
> Textfile. I used the example for changing the style of a span from here:
> http://incubator.apache.org/odftoolkit/simple/document/cookbook/Text%20Document.html#Span
> This is my code:
> TextNavigation navigation = new TextNavigation("Word I'm looking
> for", document);
> if (navigation.hasNext()) {
> TextSelection selection = (TextSelection)
> navigation.nextSelection();
> Span span = Span.newSpan(selection);
> DefaultStyleHandler style = span.getStyleHandler();
> style.getTextPropertiesForWrite().setFontColor(Color.GREEN);
> }
> But the last line in the if block throws an NullPointerException. Here is the
> stack trace:
> Exception in thread "main" java.lang.NullPointerException
> at
> org.odftoolkit.simple.style.DefaultStyleHandler.getWritableStyleElementByName(DefaultStyleHandler.java:528)
> at
> org.odftoolkit.simple.style.DefaultStyleHandler.getStyleElementForWrite(DefaultStyleHandler.java:598)
> at
> org.odftoolkit.simple.style.DefaultStyleHandler.getTextPropertiesForWrite(DefaultStyleHandler.java:214)
> at
> etl.squared.informationextraction.Annotator.annotate(Annotator.java:124)
> at etl.squared.informationextraction.Annotator.main(Annotator.java:143)
--
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: http://www.atlassian.com/software/jira