Bonjour
1 ) findfirst et findnext retournent un textrange ou null mais pas un
booléen : extrait du devGuide 7.3.3 Search and replace
The methods findFirst() and findNext() return a
com.sun.star.uno.XInterface pointing to
an object that contains the found item. If the search is not successful,
a null reference to an XInterface is returned, that is, if you try to
query other interfaces from it, null is returned.
et dans l'IDL :
findFirst
::com::sun::star::uno::XInterface
findFirst( [in] XSearchDescriptor xDesc );
Description
searches the contained texts for the next occurrence of whatever is
specified.
Returns
the position within the component, e.g. a
::com::sun::star::text::XTextRange which determines the found elements.
2 ) il ne me semble pas nécessaire de re-créer un curseur (qui est un
textrange) sur le textrange postrouve, autant se servir du textrange
lui-même pour faire la modif:
postrouve.string = "£"
3 ) j'aurais plutôt écris findnext(postrouve.end,jecherche)
Mais, bien sûr, les points 2 et 3 n'engagent que moi ;-)
Cordialement
Marceau
Bruno ABRATANSKI a écrit :
Mettre un false à la place de Null ?
Ça empeche pas l'erreur lors du findnext non ?
-----Message d'origine-----
De : Manuel NAUDIN [mailto:[EMAIL PROTECTED]
Envoyé : lundi 13 novembre 2006 12:04
À : prog@fr.openoffice.org
Objet : Re: [prog] Pb Recherche Remplace dans Writer
Le 13/11/06, Bruno ABRATANSKI <[EMAIL PROTECTED]> a écrit :
Bonjour,
Bonjour,
Pb lors d'un recherche remplace je fais :
postrouve = mondocument.findfirst(jecherche) boucle
si postrouve = null sortir
curseur = mondocument.text.cretaetextcursorbyrange(postrouve)
curseur.string = "£"
postrouve = mondocument.findnext(postrouve,jecherche)
fin
Lors du findnext j'ai une erreur comme quoi le type de la variable
postrouve est incompatible alors que le findfirst a bien fonctionné ??
moi j'aurais fait :
<code>
postrouve = mondocument.findfirst(jecherche) boucle
si postrouve = false sortir
curseur = mondocument.text.cretaetextcursorbyrange(postrouve)
curseur.string = "£"
postrouve = mondocument.findnext(postrouve, ,jecherche) fin </code>
*Bruno ABRATANSKI**
*
Manuel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]