7 messages in org.openoffice.fr.prog[prog] Réf. : Re: [prog] Insertion de...
FromSent OnAttachments
Alexandre MILLOTJul 8, 2004 2:16 am.gif
Tony GALMICHEJul 8, 2004 6:03 am 
Alexandre MILLOTJul 8, 2004 6:12 am.gif, .jpg
Bernard MarcellyJul 8, 2004 6:52 am 
Tony GALMICHEJul 8, 2004 7:03 am 
Tony GALMICHEJul 8, 2004 7:42 am 
Alexandre MILLOTJul 8, 2004 7:51 am.gif
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:[prog] Réf. : Re: [prog] Insertion de Champ utilisateur dans un tableauActions...
From:Alexandre MILLOT (alex@mistral.fr)
Date:Jul 8, 2004 7:51:05 am
List:org.openoffice.fr.prog
Attachments:

Merci beaucoup à vous deux, à toi Bernard pour la solution qui en effet est générique ( ce qui m'arrange bigrement) et à toi Tony pour les eclaircissements sur le Tableaux, j'en avais bien besoin.

Merci encore. @++ -------Message original-------

De : pr@fr.openoffice.org Date : 07/08/04 16:00:31 A : pr@fr.openoffice.org Sujet : Re: [prog] Insertion de Champ utilisateur dans un tableau

At 2004-07-08 11:17, Alexandre MILLOT wrote:

Bonjour,

J'ai ecrit une macro qui permet d'inserer un champ utilisateur à la position courante su curseur, or lorsque celui ci est dans un tableau j'ai un message d'erreur. Ci-Joint le code que j'utilise, merci d'avance.

Sub InsertChampUtilisateur(oDoc as Object, strVarName As String) oChampUtilisateur = oDoc.createInstance("com.sun.star.text.TextField.User") sName = "com.sun.star.text.FieldMaster.User." + strVarName bFound = oDoc.getTextFieldMasters.hasbyname(sName) ' contrôle l'existence de la variable if bFound Then objFieldMaster = oDoc.getTextFieldMasters.getByName(sName) oChampUtilisateur.attachTextFieldMaster(objFieldMaster) oText = oDoc.getText ' Récupération du curseur visible de l'utilisateur oController = oDoc.currentController oViewCursor = oController.getViewCursor() oCursor = oText.createTextCursorByRange(oViewCursor) oText.insertTextContent(oCursor, oChampUtilisateur, false) oText.insertString(oCursor, " ", true) End If End Sub

Lorsque tu es dans un tableau (ou un en-tête, ou un cadre, etc) tu n'est plus dans le texte principal. Il faut alors récupérer l'objet texte correspondant. Le curseur visible peut le fournir. oText = oViewCursor.getText le reste est identique.

Bernard