Thanks Ian. I really appreciate.

I'll explain what i pretend to do and that'll save us some time :)

I want to access to the different elements in an odt file in Java and also access their properties. Right now, with SimpleApi i can do that. The problem came with bold text in a paragraph.

To put an example that what i'm looking for, i would like to work with Odf Toolkit like Apache POI library.

For this very example, in Apache POI, each paragraph have runs (group of text that have the same properties) and i can acces his properties to check, for example, if it's bold or it isnt.

There's a way to work with OdfToolkit in the same way?

Really gratefull for your help. Yago.


El 09/01/2013 2:06, Ian C escribió:
Hi Yago,

I'm easy just ask away. Either in new email or this thread.

Cheers,

Ian

On Tue, Jan 8, 2013 at 11:40 PM, Yago Quiñoy Lobariñas
<[email protected]> wrote:
Hi Ian.

You were right with TextExtractor. This class gets all text even if it is in
span tags.

I have another question and i dont know if i have to do them in a new mail.
Do i have to?

Thanks. Yago.

El 08/01/2013 15:09, Ian C escribió:

Hi,

check out the TextExtractor class it uses the visitor pattern to grab the
text from child elements.

I seem to remember a example in the cookbook.

I think your bold text may be ignored because it is in a span element
within a paragraph, so your code will not see it.

Cheers,

Ian


On Tuesday, January 8, 2013, Yago Quiñoy Lobariñas <[email protected]>
wrote:
Hi.

I've loaded a odt file in my Java code and im trying to get all document
text with SimpleApi.
The problem comes when some middle text is marked as bold text. SimpleApi
ignores it and just shows the rest of the paragraph's text.
Here is the code:

{CODE}
String allText = "";
          try {
              TextDocument odt = TextDocument.loadDocument(docPath);

              Iterator<Paragraph> ip = odt.getParagraphIterator();

              while (ip.hasNext()) {

                  Paragraph paragraph = ip.next();

                  //All text in paragraph
                  allText = paragraph.getTextContent();
                  System.out.println(allText);

                  //I'm checking paragraph to ensure that there is my bold
text.
                  TextParagraphElementBase domp =
paragraph.getOdfElement();
                  System.out.println(domp.toString());

              }

          } catch (Exception ex) {
              ex.printStackTrace();
          }
{CODE:END}

An here is the output.

aaaaaaaaaaaaaacccccccccccccc
<text:p text:style-name="Standard">aaaaaaaaaaaaaa<text:span
text:style-name="T1">bbbbbbbbbbbbbbbbb</text:span>cccccccccccccc</text:p>
Thanks
--
Yago Quiñoy Lobariñas
Área de desarrollo
INDENOVA S.L.
P.I. Vara de Quart
C/Dels Traginers 14, 2º planta izq.
46014 Valencia
Tel.(34) 96 381 99 47

[email protected] <mailto:[email protected]>
www.indenova.com <http://www.indenova.com/>

*RESPETEMOS EL MEDIO AMBIENTE*:¿Necesita realmente imprimir este email?
*PLEASE RESPECT THE ENVIRONMENT*: Do you really need to print this email?
*CONFIDENCIALIDAD*: Este email es confidencial y para uso exclusivo de su
destinatario.
*CONFIDENTIALITY*: This email is confidential and for the exclusive use
of its addressee.

---------------------------------------------------------------------------------------------------
Descargue el visor gratuito de archivos firmados electrónicamente eSigna
Viewer:
http://www.indenova.com/eSignaViewer.php

---------------------------------------------------------------------------------------------------



--
Yago Quiñoy Lobariñas
Área de desarrollo
INDENOVA S.L.
P.I. Vara de Quart
C/Dels Traginers 14, 2º planta izq.
46014 Valencia
Tel.(34) 96 381 99 47

[email protected] <mailto:[email protected]>
www.indenova.com <http://www.indenova.com/>

*RESPETEMOS EL MEDIO AMBIENTE*:¿Necesita realmente imprimir este email?
*PLEASE RESPECT THE ENVIRONMENT*: Do you really need to print this email?
*CONFIDENCIALIDAD*: Este email es confidencial y para uso exclusivo de su
destinatario.
*CONFIDENTIALITY*: This email is confidential and for the exclusive use of
its addressee.

---------------------------------------------------------------------------------------------------
Descargue el visor gratuito de archivos firmados electrónicamente eSigna
Viewer:
http://www.indenova.com/eSignaViewer.php
---------------------------------------------------------------------------------------------------






--
Yago Quiñoy Lobariñas
Área de desarrollo
INDENOVA S.L.
P.I. Vara de Quart
C/Dels Traginers 14, 2º planta izq.
46014 Valencia
Tel.(34) 96 381 99 47

[email protected] <mailto:[email protected]>
www.indenova.com <http://www.indenova.com/>

*RESPETEMOS EL MEDIO AMBIENTE*:¿Necesita realmente imprimir este email?
*PLEASE RESPECT THE ENVIRONMENT*: Do you really need to print this email?
*CONFIDENCIALIDAD*: Este email es confidencial y para uso exclusivo de su destinatario. *CONFIDENTIALITY*: This email is confidential and for the exclusive use of its addressee.

---------------------------------------------------------------------------------------------------
Descargue el visor gratuito de archivos firmados electrónicamente eSigna Viewer:
http://www.indenova.com/eSignaViewer.php
---------------------------------------------------------------------------------------------------


Reply via email to