You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-dev@incubator.apache.org by "Svante Schubert (JIRA)" <ji...@apache.org> on 2017/05/18 15:03:04 UTC
[jira] [Commented] (ODFTOOLKIT-452) Insert Document
[ https://issues.apache.org/jira/browse/ODFTOOLKIT-452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16015897#comment-16015897 ]
Svante Schubert commented on ODFTOOLKIT-452:
--------------------------------------------
I quickly looked into it.
First of all, to make the problem easy reproducable the extension of a text is most appropriate. For instance, your example only works on Windows due to your file names.
To extend a test, take a look which library you are using, for instance, you are using the SIMPLE library, therefore the following file might work:
org.odftoolkit.simple.text.ParagraphTest
A test might look like:
@Test
public void testList() {
try {
TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("templateForBase.odt"));
TextDocument doc4insertion = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("templateForInsertion.odt"));
Paragraph paragraph = doc.addParagraph("");
doc.insertContentFromDocumentBefore(doc4insertion, paragraph, true);
doc.save(ResourceUtilities.newTestOutputFile("embeddedListOutput.odt"));
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
Assert.fail();
}
}
Your input files would have to be placed on the path simple/src/test/resources
The output file would be found after testing at simple/target/test-classes
I can reproduce your problem and would guess it is a problem of styles being used.
It is not really an embedded document, as an embedded document would receive a new directory and can keep all the files.
Instead, it is inserted somewhere and the existing styles are all renamed. Unfortunately, even similar styles receive different names.
Even further unfortunate, the IBM developers, who wrote this functionality have left the project and are no longer maintaining the source code, neither do I. I focus on the odfdom part.
The idea is to concatenate various ODT document, the problem what are you doing with different styles?
I suggest you give it a try to fix yourself or ask for someone (or hire someone) who might do this for you.
Good luck,
Svante
> Insert Document
> ---------------
>
> Key: ODFTOOLKIT-452
> URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-452
> Project: ODF Toolkit
> Issue Type: Bug
> Reporter: Giuseppe Miniello
> Attachments: template.odt, TestOdfToolkit.java, test.odt, tmp08610502224696135458.odt
>
>
> I'm using ODF Toolkit for manipulate odt documents, when i try to insert an odt with numbered list into another odt but the result is wrong.
> The final document loses the correct numbering.
> The example is "TestOdfToolkit.java", the base document is "template.odt" and the document that i try to insert is "tmp08610502224696135458.odt".
> The result doc "test.odt" loses the correct numbering.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)