Date: prev next · Thread: first prev next last


Hi Svante,

Thank you for getting back to me so quickly!

1) I "resaved" the .fodt file to a regular .odt file with LibreOffice and was able to quickly resolve this issue as you had suggested. I mistakenly "just assumed" that the toolkit would handle any type of odt related files and had previously used the flat odt since it was a way I could easily see DOM contents.

2) I certainly understand the time limitations and priorities you have when doing such a migration. I just pointed out the broken links just in case you weren't aware of it.

3) You already have the "Simple API (deprecated)" link on the odftoolkit.org web site and I'm guessing that most users of the ODF Toolkit will be like me and will not need more than that. It was certainly enough to do I needed to do with the Toolkit at the time. Unless I'm mistaken and since it's deprecated, there's no clear path on how to move beyond the deprecation. It would be nice to have a updated https://odftoolkit.org/simple/gettingstartguide.html and https://odftoolkit.org/simple/document/cookbook/index.html that don't use the deprecated simple library.

For example, I am now stuck at this point in my code:

template = TextDocument.loadDocument(templateFile);
String docSearchFieldName = "LastName";
VariableField myField = template.getVariableFieldByName(docSearchFieldName);

as I'm getting

java.lang.NoSuchMethodError: 'org.odftoolkit.simple.common.field.VariableField org.odftoolkit.simple.TextDocument.getVariableFieldByName(java.lang.String)'

I don't know what has replaced this method or how to move beyond this point.

Thanks,

Andrew

On 2021-03-31 6:03 p.m., Svante Schubert wrote:
Hello Andrew,

    1. You get a ZIP file error, as it seems you are loading a flat XML file
    (all XML in one file without ZIP).
    The usual suffix is ODT and your file's suffix is FODT.
    Drag & Drop your input file into a text editor or try to unzip it. :-)
    2. The broken links are a combination mistake of Michael and me, I have
    not fixed it as I am chewing on an 8-year-old source code generation
    problem.
    But I am getting closer...
    3. Example Code can be found in the test folder of ODFDOM, but you are
    absolutely right it should be better documented. Any suggestions on where
    to place it?
    Considering switching the HTML generation from old proprietary (no
    longer supported) Apache Markdown to HTML conversion with Sphinx - created
    for API documentation in the first place.

Good luck and happy holidays!
Svante

Am Mi., 31. März 2021 um 21:38 Uhr schrieb Andrew Willerding <
awillerding@callistacti.com>:

Hi,

I haven't used the ODF libraries since they were part of Apache and now
I have a project I'd like to make use of manipulating and creating ODF
files and understand that "things have changed."  ;-)

I'm trying to run this code which ran fine with the Apache libraries

          try {
              template = TextDocument.loadDocument(templateFile);
          } catch (Exception ex) {
              logItem("Template:" + templateFile.getAbsolutePath()
                      + ",TemplateFile not found.",
                      ex);
              throw new IOException(ex.getMessage());
          }

and receiving

java.lang.IllegalArgumentException:
org.odftoolkit.odfdom.pkg.OdfValidationException; The ODF package
'file:////ReportTemplates/ReportAgr.fodt' shall be a ZIP file!

My Maven dependency is ..

          <dependency>
              <groupId>org.odftoolkit</groupId>
              <artifactId>simple-odf</artifactId>
              <version>0.9.0-RC1</version>
<classifier>jar-with-dependencies</classifier>
          </dependency>

I guess I have 2 questions.  The immediate question is why am I getting
the ZIP file error and how do I fix the situation.  The second question
is where do I find the documentation on how to use the new ODF Toolkit?
The links seem to be broken on the web site.
(https://tdf.github.io/odftoolkit/docs/
<https://tdf.github.io/odftoolkit/docs/>) I have a simple need.  I have
created a template document that I want to use to replace fields (like
name, address) with dynamic values and also add items to an existing table.

Some existing example Java code to do this would be very very helpful.


Thanks,

Andrew


--
Andrew Willerding
Callista CTI

    ph: 416 444-9702 x9455
    fx: 416 444-9732
cell: 416 712-2323
   www: http://www.callistacti.com


--
To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
Problems?
https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.odftoolkit.org/dev/
Privacy Policy: https://www.documentfoundation.org/privacy

--
Andrew Willerding
Callista CTI

  ph: 416 444-9702 x9455
  fx: 416 444-9732
cell: 416 712-2323
 www: http://www.callistacti.com


--
To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.odftoolkit.org/dev/
Privacy Policy: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.