incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bob Hecker (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ODFTOOLKIT-383) Object TextNavigation doesn't return search value
Date Wed, 02 Jul 2014 10:12:24 GMT

    [ https://issues.apache.org/jira/browse/ODFTOOLKIT-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14049800#comment-14049800
] 

Bob Hecker commented on ODFTOOLKIT-383:
---------------------------------------

I don't know how this bug tool is supposed to work but I was wondering if someone looked at
this? Or do I need to provide more information?

> Object TextNavigation doesn't return search value
> -------------------------------------------------
>
>                 Key: ODFTOOLKIT-383
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-383
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: simple api
>    Affects Versions: 0.6-incubating
>            Reporter: Bob Hecker
>            Priority: Minor
>              Labels: Replace, Search, TextNavigation, loadDocument
>
> When I load an .ott file and I try to search for placeholders I encounter strange behavior.
Some of the placeholders (not all) in the template cannot be found. I use the code shown below
to open the document and search for the placeholders
> TextDocument odt = TextDocument.loadDocument("/template-001.ott");
> TextNavigation search = new TextNavigation("<name>", odt);
> while (search.hasNext()) {                
>    TextSelection item = (TextSelection) search.nextSelection();
>    System.out.println("Placeholder found");
>    item.replaceWith("SOME_TEXT");
> }
> The code works because some placeholders get replaced, but unfortunately not all. The
only difference I can find between the placeholders is the way they are recorded in the .ott
file Openoffice generated.
> The placeholders who get replaced have this syntax:
> <text:span text:style-name="T5">
>    <text:placeholder text:placeholder-type="text">&lt;name&gt;    </text:placeholder>
> </text:span>
> While the placeholders who don't get replaced are recorded this way:
> <text:placeholder text:placeholder-type="text">&lt;name&gt;</text:placeholder></text:p>
> The ones who get replaced seem to have a text:span tag. I'm not sire if this is the real
cause of the problem but when I give the specific fields (who are not working) a text:span
tag they seem to get replaced.
> I dont't have any deep knowledge of the odftoolkit but I think the loadDocument does
something with the data so the TextNavigation can't find the specific elements. Or the TextNavigation
is not functioning as I would expect.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message