11 messages in org.openoffice.fr.progRe: [prog] Liste des sous-sections d'...
FromSent OnAttachments
Tony GALMICHEJul 12, 2004 11:16 am 
BobJul 12, 2004 12:06 pm 
Agnès SimonetJul 12, 2004 1:52 pm 
Tony GALMICHEJul 12, 2004 10:53 pm 
Tony GALMICHEJul 12, 2004 10:57 pm 
BobJul 13, 2004 2:55 am 
Bernard MarcellyJul 13, 2004 7:43 am 
Agnès SimonetJul 13, 2004 10:11 am 
Tony GALMICHEJul 13, 2004 11:23 pm 
Tony GALMICHEJul 13, 2004 11:23 pm 
Agnès SimonetJul 14, 2004 1:03 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 des sous-sections d'une section connueActions...
From:Agnès Simonet (agne@laposte.net)
Date:Jul 13, 2004 10:11:47 am
List:org.openoffice.fr.prog

Bonjour, (deux fois vaut mieux qu'aucune ;-) ) Tony GALMICHE a écrit :

Bonjour Agnès,

Agnès Simonet a écrit le 12/07/04 22:52 :

Et si à chaque fois que tu récupères une section fille tu récupérais aussi son ancre (getAnchor) /coupé/

J'ai également pensé à cette méthode, mais elle me parait bien compliquée et je ne sais pas bien manipuler les ancres.

La solution idéale, serait de pouvoir faire un CreateEnumeration uniquement sur la section connue, mais je n'ai pas trouvé comment faire et je ne sais même pas si c'est possible.

Et bien si on combinait nos deux pistes ? D'abord récupérer l'ancre de la section mère. C'est un TextRange qui supporte createEnumération. Donc on peut faire ce que tu souhaites. J'ai juste essayé sur un doc avec une section mère et 3 sections filles "désordonnées". Ça marchait. Mais je vois que le grand maître a parlé, tu as sans doute plus de chances de ce coté là.

sub ListeSousSections()

NomSectionParent="Parent" oDoc=ThisComponent oSectionParent=oDoc.GetTextSections.GetByName(NomSectionParent) oSectionsFille=oSectionParent.getChildSections oAnchorSectionParent = oSectionParent.Anchor oEnum= oAnchorSectionParent.CreateEnumeration While oEnum.hasMoreElements TextElement=oEnum.NextElement if TextElement.SupportsService("com.sun.star.text.Paragraph") then oSection=TextElement.TextSection if not isempty(oSection) then oParentSection=oSection.ParentSection if not isnull(oParentSection) then if oParentSection.name=NomSectionParent then msgbox oSection.name end if end if end if Wend

end sub