13 messages in org.openoffice.fr.progRe: [prog] question sur copier/coller...
FromSent OnAttachments
THEVENOUX Jean-PhilippeJun 28, 2005 3:20 am 
Laurent GodardJun 28, 2005 3:26 am 
Jean...@i-carre.netJun 28, 2005 4:23 am 
THEVENOUX Jean-PhilippeJun 28, 2005 6:15 am 
Laurent GodardJun 28, 2005 6:23 am 
THEVENOUX Jean-PhilippeJun 28, 2005 6:50 am 
Didier Dorange-PattoretJun 28, 2005 7:23 am 
Bernard MarcellyJun 29, 2005 1:37 am 
Bernard MarcellyJul 6, 2005 1:49 am 
Ladislas SmiaJul 6, 2005 5:04 am 
Alain NowakJul 7, 2005 1:09 am 
Sebastien ChazalletJul 7, 2005 10:30 am 
Alain NowakJul 8, 2005 12:39 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] question sur copier/coller dans CalcActions...
From:Bernard Marcelly (marc@club-internet.fr)
Date:Jun 29, 2005 1:37:33 am
List:org.openoffice.fr.prog

Le 2005-06-28 12:20, THEVENOUX Jean-Philippe a écrit :

J'ai un problème lors d'un copier/coller via une macro, le coller marche, mais pas le copier donc au final, la macro colle la dernière chose qui a été copier, et non pas ce que j'ai demandé. Ah oui, le copier/coller se fait dans deux fichiers !!!

Voila ma macro simplifié : ( . . . ) oDoc = StarDesktop.LoadComponentFromURL(convertToURL(CheminSource + "Essai.ods"), "_blank", 0 ,Args())

Bonjour Jean-Philippe, L'important dans ta macro, c'est qu'elle est exécutée avec une version non finalisée de la version 2 d'OpenOffice. Il faut toujours se méfier dans ce cas. J'ai refait deux essais plus simples afin de cerner le problème. J'utilise Windows XP Home SP2.

--------

Essai 1 : copier-coller dans la même feuille du même document.

Sub copierEtColler dim Feuille as object dim oRange as object dim Args(0) as new com.sun.star.beans.PropertyValue dim dispatcher as object dim oDoc as object dim args4(5) as new com.sun.star.beans.PropertyValue

dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") Feuille = ThisComponent.Sheets.getByName("Feuille1") oRange = Feuille.getCellRangeByName("B5:C6") ThisComponent.CurrentController.Select(oRange)

' copier la zone actuellement sélectionnée dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy", "", 0, Array())

oRange = Feuille.getCellRangeByName("F4") ThisComponent.CurrentController.Select(oRange) ' coller dans la nouvelle zone dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Paste", "", 0, array()) End Sub

La macro est déclenchée par un bouton sur la même feuille. OOo 1.1.4 (fichier sxc) : la macro fonctionne correctement OOo 1.9.100 (fichier ods) : la macro ne copie rien et ne colle rien OOo 1.9.100 (fichier sxc) : la macro ne copie rien et ne colle rien

------

Essai 2 : copier depuis un document, coller vers un autre document

Sub copierCollerEntreDocs dim Feuille as object, Feuille2 as object dim oRange as object dim Args(0) as new com.sun.star.beans.PropertyValue dim dispatcher as object dim oDoc as object dim args4(5) as new com.sun.star.beans.PropertyValue

dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") Feuille = ThisComponent.Sheets.getByName("Feuille1") oRange = Feuille.getCellRangeByName("B5:C6") ThisComponent.CurrentController.Select(oRange)

' copier la zone actuellement sélectionnée dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy", "", 0, Array()) ' ouvrir autre document CheminSource = "C:\Docs OpenOffice\" Args(0).Name = "Hidden" Args(0).Value = true oDoc = StarDesktop.LoadComponentFromURL(convertToURL(CheminSource + "cibleO2.ods"), "_blank", 0 ,Args()) Feuille2 = oDoc.Sheets.getByName("Feuille2") oRange = Feuille2.getCellRangeByName("F4") oDoc.CurrentController.Select(oRange) ' coller dans la nouvelle zone dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:Paste", "", 0, array()) oDoc.Store oDoc.Close(True) End Sub

La macro est déclenchée par un bouton sur la même feuille du premier document. OOo 1.1.4 (fichier sxc) : la macro fonctionne correctement OOo 1.9.100 (fichier ods) : la macro ne copie rien, mais colle le contenu courant du presse-papier. OOo 1.9.100 (fichier sxc) : la macro ne copie rien, mais colle le contenu courant du presse-papier.

------------

Conclusion: Tu as trouvé une belle bogue. Il ne te reste plus qu'à faire un joli rapport en anglais sur IssueZilla et prier les dieux de la programmation pour qu'elle soit corrigée un jour.

Bonne journée Bernard