2 messages in org.openoffice.fr.progRe: [prog] Liste énumérée, récupérati...
FromSent OnAttachments
BobOct 23, 2004 7:36 am 
Bernard MarcellyOct 27, 2004 2:28 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] Liste énumérée, récupération du caractère "puce" (BulletChar)Actions...
From:Bernard Marcelly (marc@club-internet.fr)
Date:Oct 27, 2004 2:28:27 am
List:org.openoffice.fr.prog

At 2004-10-23 16:36, Bob wrote:

Je suppose qu'il doit être possible d'accéder à la propriété (ou pseudo-propriété ?) "BulletChar" sans parcourir toute la boucle comme dans le code ci-dessous ? (RMQ 1)

non - c'est un conteneur très bête.

D'autre part, pour que ça marche avec la boucle for/next, je suis obligé d'affecter des variables sName et sValue (RMQ2) ! Si j'écris directement la ligne sous RMQ 3, ça ne marche pas ! je ne comprends pas pourquoi.

- parce que les propriétés ont des valeurs de divers types. Quand tu affectes une valeur à sValue déclaré comme String tu fais une conversion en chaîne de caractères. - une expression Basic est toujours évaluée complètement, il n'y a pas d'optimisation, alors que si tu avais testé avec deux if imbriqués cela marcherait.

<code> function BulletChar(oTheParagraph as object) as string dim sName as string dim sValue as string dim oRules dim oX dim i as Integer on error resume next

BulletChar = "" if (not isNull(oTheParagraph.NumberingRules) and not isEmpty(oTheParagraph.NumberingRules)) then oRules = oTheParagraph.NumberingRules oX = oRules.getByIndex(oTheParagraph.NumberingLevel) ' XRay.XRay oRules ' XRay.XRay oX

' RMQ 1: voir si l'on ne peut pas faire un getPropertyValue("BulletChar") plutot que cette boucle for i = lbound(oX) to ubound(oX) ' RMQ 2: voir pourquoi il faut passer par cette affectation dans 2 string pour que ca marche !!! sName = oX(i).Name sValue = oX(i).Value ' RMQ 3: voir pourquoi cette ligne ne marche pas !!! ' if (oX(i).Name = "BulletChar") and (oX(i).Value <> "") then if (sName = "BulletChar") and (sValue <> "") then BulletChar = oX(i).Value ' RMQ: pour debug 'MsgBox "bullet=" & oX(i).Value exit for end if next end if

end function

</code>