TextPElement paraLast = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
addImageToDocument(contentDom, paraLast);
// Access/Update automatic styles
OdfOfficeAutomaticStyles autoStyles = embDoc.getContentDom().getAutomaticStyles();
OdfStyle autoStyle = autoStyles.getStyle("P1", OdfStyleFamily.Paragraph);
Assert.assertEquals(autoStyle.getStyleNameAttribute(), "P1");
Assert.assertEquals(autoStyle.getFamilyName(), "paragraph");
// Access/Update styles.xml
OdfStyle documentStyle = embDoc.getDocumentStyles().getStyle("myStyle", OdfStyleFamily.Paragraph);
Assert.assertEquals(documentStyle.getStyleNameAttribute(), "myStyle");
Assert.assertEquals(documentStyle.getFamilyName(), "paragraph");
documentStyle.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
documentStyle.setProperty(StyleParagraphPropertiesElement.BackgroundColor, "#14EA5D");
// SAVE / LOAD
docWithEmbeddedObjects.save(TEST_FILE_ACCESS_EMBEDDED);
Document doc2 = Document.loadDocument(TEST_FILE_ACCESS_EMBEDDED);
Document embDoc2 = doc2.getEmbeddedDocument("Object 1/");
embDoc2.getStylesDom();
OdfStyle documentStyle2 = embDoc2.getDocumentStyles().getStyle("myStyle", OdfStyleFamily.Paragraph);
String prop2 = documentStyle2.getProperty(StyleTextPropertiesElement.FontWeight);
Assert.assertEquals(prop2, "bold");
TextSpanElement spanTest = (TextSpanElement) xpath.evaluate("//text:p[1]/text:span[1]", contentDom,
XPathConstants.NODE);
Assert.assertEquals(spanTest.getTextContent(), TEST_SPAN_TEXT);