public void testinsertContentFromDocumentBefore() throws Exception {
TextDocument src1 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestInsertDocument.odt"));
TextDocument src2 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestInsertDocument.odt"));
TextDocument target1 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestInsertDocument.odt"));
TextDocument target2 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestInsertDocument.odt"));
Paragraph p1 = target1.getParagraphByIndex(2, true);
target1.insertContentFromDocumentBefore(src1, p1, true);
Iterable<OdfStyle> pstyles1 = target1.getStylesDom().getOfficeStyles().getStylesForFamily(OdfStyleFamily.Paragraph);
Iterator<OdfStyle> ite = pstyles1.iterator();
int i=0;
System.out.println("Custom Styles in TestInsertDocumentWithStyleBefore.odt");
while(ite.hasNext()){
OdfStyle odfStyle = ite.next();
String sname = odfStyle.getAttribute("style:name");
if(sname.startsWith("style"))
{
i++;
System.out.println(sname);
}
}
Assert.assertEquals(6, i);
target1.save(ResourceUtilities.newTestOutputFile("TestInsertDocumentWithStyleBefore.odt"));
target2 = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestInsertDocument.odt"));
Paragraph p2 = target2.getParagraphByIndex(2, true);
target2.insertContentFromDocumentBefore(src2, p2, false);
Iterable<OdfStyle> pstyles2 = target2.getStylesDom().getOfficeStyles().getStylesForFamily(OdfStyleFamily.Paragraph);
Iterator<OdfStyle> ite2 = pstyles2.iterator();
i=0;