Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index



Le 20/08/2011 14:33, Jean Michel PIERRE a écrit :
Le 20/08/2011 13:03, andriant.sandy a écrit :
Bonjour,

Comment dois-je intégrer

[QUOT]dispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0, Array())[/QUOT]
dans une macro pour obtenir 1 tableau à 1 seule colonne, largeur : 100% ?

http://www.oooforum.org/forum/viewtopic.phtml?t=102575

Cordialement,
Sandy-Pascal Andriant


Ce code fonctionne :

REM  *****  Insère Tableau avec 1 ligne et 1 colonne  *****


sub Tableau_1_ligne_1_colonne
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(3) as new com.sun.star.beans.PropertyValue
args1(0).Name = "TableName"
args1(0).Value = "Tableau1"
args1(1).Name = "Columns"
args1(1).Value = 1
args1(2).Name = "Rows"
args1(2).Value = 1
args1(3).Name = "Flags"
args1(3).Value = 9

dispatcher.executeDispatch(document, ".uno:InsertTable", "", 0, args1())
end sub


mais il y a d'autres manières sans Macro  :
http://wiki.documentfoundation.org/FR/FAQ/Writer/136
J.M


Merci pour ce code qui fonctionne parfaitement.
Mais comme j'ai mal posé ma question je n'ai pas obtenu la réponse adéquate.

Je dois traiter quotidiennement plusieurs transferts de tableaux (1 col et 12 à 50 li) issus d'excel dans 1 doc Writer.
Pour pouvoir conserver la mise en forme je fais Ctrl+Maj+V (Texte formaté [RTF])

Or ce copier-coller me donne des tableaux d'un format de 72 %

Je passe ce tableau dans une macro qui modifie la police et le quadrillage.
Mais je n'arrive pas à ajouter la propriété : largeur 100%

Voici le code très sale par "enregistrer une macro" :

sub tableau_100
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(4) as new com.sun.star.beans.PropertyValue
args1(0).Name = "CharFontName.StyleName"
args1(0).Value = ""
args1(1).Name = "CharFontName.Pitch"
args1(1).Value = 2
args1(2).Name = "CharFontName.CharSet"
args1(2).Value = -1
args1(3).Name = "CharFontName.Family"
args1(3).Value = 5
args1(4).Name = "CharFontName.FamilyName"
args1(4).Value = "Arial"

dispatcher.executeDispatch(document, ".uno:CharFontName", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "FontHeight.Height"
args2(0).Value = 10
args2(1).Name = "FontHeight.Prop"
args2(1).Value = 100
args2(2).Name = "FontHeight.Diff"
args2(2).Value = 0

dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args2())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:BorderInner", "", 0, Array())

rem ----------------------------------------------------------------------
dim args4(7) as new com.sun.star.beans.PropertyValue
args4(0).Name = "BorderOuter.LeftBorder"
args4(0).Value = Array(0,0,9,0,0,9)
args4(1).Name = "BorderOuter.LeftDistance"
args4(1).Value = 49
args4(2).Name = "BorderOuter.RightBorder"
args4(2).Value = Array(0,0,9,0,0,9)
args4(3).Name = "BorderOuter.RightDistance"
args4(3).Value = 49
args4(4).Name = "BorderOuter.TopBorder"
args4(4).Value = Array(0,0,9,0,0,9)
args4(5).Name = "BorderOuter.TopDistance"
args4(5).Value = 0
args4(6).Name = "BorderOuter.BottomBorder"
args4(6).Value = Array(0,0,9,0,0,9)
args4(7).Name = "BorderOuter.BottomDistance"
args4(7).Value = 0

dispatcher.executeDispatch(document, ".uno:BorderOuter", "", 0, args4())

rem ----------------------------------------------------------------------
dim args5(3) as new com.sun.star.beans.PropertyValue
args5(0).Name = "BorderShadow.Location"
args5(0).Value = com.sun.star.table.ShadowLocation.NONE
args5(1).Name = "BorderShadow.Width"
args5(1).Value = 180
args5(2).Name = "BorderShadow.IsTransparent"
args5(2).Value = false
args5(3).Name = "BorderShadow.Color"
args5(3).Value = 8421504

dispatcher.executeDispatch(document, ".uno:BorderShadow", "", 0, args5())


end sub

Cordialement,
Sandy-Pascal Andriant





--
Envoyez un mail à users+help@fr.libreoffice.org pour savoir comment vous désinscrire
Les archives de la liste sont disponibles à http://listarchives.libreoffice.org/fr/users/
Tous les messages envoyés sur cette liste seront archivés publiquement et ne pourront pas être 
supprimés

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.