La modération vous a écrit: Merci de joindre les macros en question avec le fichier
J'ai un tableau dynamique qui nécessite à chaque actualisation une mise en page pour l'impression.
Chaque colonne de ce tableau a sa propre taille de caractère / gras etc... pour une meilleure lecture une fois imprimé sur papier.
J'ai donc enregistré une macro pour chaque colonne avec son bouton attitré j'ai pas trouver mieux ... pour l'instant.
L'idée serait de regrouper toutes ces macros en un seul bouton... si possible, sachant que, chaque macro doit agir sur sa colonne ... j'espère être clair.
Il y a peut être d'autres solutions ? étant novice en tableur j'ai quelques difficultés à imaginer toutes ses capacités.
Merci d'avance pour votre aide.
Code : Tout sélectionner
REM ***** BASIC *****
Sub Largeur
Dim Table_dynamique_Base_1 As Object
Table_dynamique_Base_1 = ThisComponent.sheets.getByName("Table_dynamique_Base_1")
Table_dynamique_Base_1.getCellRangeByName("A1").Columns.width = 3330
Table_dynamique_Base_1.getCellRangeByName("B1").Columns.width = 2830
Table_dynamique_Base_1.getCellRangeByName("C1").Columns.width = 4630
Table_dynamique_Base_1.getCellRangeByName("D1").Columns.width = 7050
Table_dynamique_Base_1.getCellRangeByName("E1").Columns.width = 1120
Table_dynamique_Base_1.getCellRangeByName("F1").Columns.width = 1390
Table_dynamique_Base_1.getCellRangeByName("G1").Columns.width = 1
end sub
sub Colonne_A
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FontHeight.Height"
args1(0).Value = 15
args1(1).Name = "FontHeight.Prop"
args1(1).Value = 100
args1(2).Name = "FontHeight.Diff"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bold"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "HorizontalAlignment"
args3(0).Value = com.sun.star.table.CellHoriJustify.CENTER
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "VerticalAlignment"
args4(0).Value = 2
dispatcher.executeDispatch(document, ".uno:VerticalAlignment", "", 0, args4())
end sub
sub Colonne_B
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FontHeight.Height"
args1(0).Value = 9
args1(1).Name = "FontHeight.Prop"
args1(1).Value = 100
args1(2).Name = "FontHeight.Diff"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bold"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "HorizontalAlignment"
args3(0).Value = com.sun.star.table.CellHoriJustify.CENTER
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "WrapText"
args4(0).Value = true
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "WrapText"
args5(0).Value = false
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "WrapText"
args6(0).Value = true
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "WrapText"
args7(0).Value = false
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "WrapText"
args8(0).Value = true
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "VerticalAlignment"
args9(0).Value = 2
dispatcher.executeDispatch(document, ".uno:VerticalAlignment", "", 0, args9())
end sub
sub Colonne_C_D
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FontHeight.Height"
args1(0).Value = 10
args1(1).Name = "FontHeight.Prop"
args1(1).Value = 100
args1(2).Name = "FontHeight.Diff"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "HorizontalAlignment"
args2(0).Value = com.sun.star.table.CellHoriJustify.CENTER
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "WrapText"
args3(0).Value = true
dispatcher.executeDispatch(document, ".uno:WrapText", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "VerticalAlignment"
args4(0).Value = 2
dispatcher.executeDispatch(document, ".uno:VerticalAlignment", "", 0, args4())
end sub
sub Colonne_E
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FontHeight.Height"
args1(0).Value = 11
args1(1).Name = "FontHeight.Prop"
args1(1).Value = 100
args1(2).Name = "FontHeight.Diff"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "HorizontalAlignment"
args2(0).Value = com.sun.star.table.CellHoriJustify.CENTER
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "VerticalAlignment"
args3(0).Value = 2
dispatcher.executeDispatch(document, ".uno:VerticalAlignment", "", 0, args3())
end sub
sub Colonne_F
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FontHeight.Height"
args1(0).Value = 7
args1(1).Name = "FontHeight.Prop"
args1(1).Value = 100
args1(2).Name = "FontHeight.Diff"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "HorizontalAlignment"
args2(0).Value = com.sun.star.table.CellHoriJustify.CENTER
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "VerticalAlignment"
args3(0).Value = 2
dispatcher.executeDispatch(document, ".uno:VerticalAlignment", "", 0, args3())
end sub