incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yago Quiñoy Lobariñas <yqui...@indenova.com>
Subject Getting bold text from Paragraph
Date Tue, 08 Jan 2013 10:45:20 GMT

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

yquinoy@indenova.com <mailto:yquinoy@indenova.com>
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
---------------------------------------------------------------------------------------------------





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message