9 messages in org.openoffice.fr.progErreur dans la création de mon article
FromSent OnAttachments
FrançoiseSep 25, 2006 5:52 am 
Laurent GodardSep 25, 2006 6:21 am 
FrançoiseSep 25, 2006 6:43 am 
Laurent GodardSep 25, 2006 6:50 am 
Laurent GodardSep 25, 2006 7:08 am 
FrançoiseSep 25, 2006 7:18 am 
Serge LE LOUARNESep 25, 2006 7:37 am 
FrançoiseSep 25, 2006 7:44 am 
Serge LE LOUARNESep 25, 2006 8:22 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:Erreur dans la création de mon articleActions...
From:Françoise (fran@versateladsl.be)
Date:Sep 25, 2006 5:52:41 am
List:org.openoffice.fr.prog

Bonjour,

Quelqu'un pourrait-il me dire pourquoi j'ai une erreur?

Juste ici : oSectionModele = oDoc.GetTextSections GetByName(NomSectionModele)

Voici la macro

Sub Creer_Heritier Dim oDoc Dim oSection as object dim oSectionModele as object Dim oCursor As Object dim Rep as integer dim NomSectionPrincipale as string dim NomSectionModele as string dim i as integer dim NomCadre as string dim oLesCadres as object dim oCadre as object dim oEnum as object dim oTextElement as object dim NumMax as integer dim Num as integer dim NumArticle as string dim oForm as object dim TabNomChamps as variant dim NomChamp as string dim oChamp as object dim TabNomSection as variant

oDoc = ThisComponent oCursor = oDoc.Text.createTextCursor()

'Vérification que la section principale existe NomSectionPrincipale = "<xml:Enot:Heritiers>" Rep = oDoc.GetTextSections.HasByName(NomSectionPrincipale) if Rep=False then msgbox "Section principale non trouvée !" exit sub else oSection = oDoc.GetTextSections.GetByName(NomSectionPrincipale) end if

***************************************************************************

'Recherche le dernier N° d'héritier créé NumMax=0 TabNomSection= oDoc.GetTextSections.getElementNames() for i = 0 to UBound(TabNomSection()) if left(TabNomSection(i),20)="<xml:Enot:Heritier> " then Num=mid(TabNomSection(i),20,100) if Num>NumMax then NumMax=Num end if next i NumArticle=right("0000" & NumMax+1,4)

***************************************************************************

'** insertion en fin de document oCursor.gotoRange(oSection.Anchor.End, false)

'**************************************************************************

'Création de la section de l'héritier NomSectionModele = "<xml:Enot:Heritier>" oSectionModele = oDoc.GetTextSections.GetByName(NomSectionModele)

'*************************************************************************** ' création de la nouvelle section oSection = oDoc.createInstance("com.sun.star.text.TextSection") oSection.Name = NomSectionModele & " " & NumArticle ' établit le lien avec la section modèle (dans le même document) oSection.FileLink.FileUrl = "" oSection.linkRegion = NomSectionModele '**************************************************************************** * ' insertion de la nouvelle section dans le document oDoc.Text.insertTextContent(oCursor, oSection, FALSE) ' coupe le lien avec la section modèle oSection.linkRegion = ""

'****************************************************************************

'Renommer les champs des formulaires oForm = thiscomponent.drawpage.Forms.GetByName("Standard") TabNomChamps=oForm.getElementNames for i = 0 to ubound(TabNomChamps) NomChamp=TabNomChamps(i) oChamp=oForm.GetByName(NomChamp) if oChamp.Tag<>"" then if oChamp.name<>oChamp.Tag then oChamp.name=oChamp.Tag & " " & NumArticle end if next

*************************************************************************** end sub