survivorr
Messages postés10Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention11 octobre 2007
-
8 mai 2006 à 12:45
houfari1
Messages postés1Date d'inscriptionjeudi 5 janvier 2006StatutMembreDernière intervention27 août 2007
-
27 août 2007 à 17:11
Bonjour tout le monde,
Je voudrai imprimer un tableau,pour cela j'utilise un MsFlexGrid pour afficher ce tableau et j'ai fait un boutant imprimer pour afficher ce tableau sous format Word mais le PROBLEME qui se pose c'est que j'ai beaucoup de colonnes dans ce tableau et alors il ne s'affiche pas correctement , je voudrai savoir est ce qu'on peut modifier la taille de police pour que toutes les colonnes s'affiche correctement.
Voilà le code que j'ai utilisé dans le boutant imprimer :
Private Sub cmdimprimer_Click()
On Error Resume Next
'Early object binding
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oRange As Word.Range
'Uncomment below for late object binding
'Dim oWord As Object
'Dim oDoc As Object
'Dim oRange As Object
Dim row As Integer
Dim col As Integer
Dim I As Integer
Dim n As Integer
Dim sTemp As String
Dim arr() As String
'Créer une instance de word
Set oWord = CreateObject("Word.Application")
'rendre le document word visible
oWord.Visible = True
'Ouivrir un nouveau document
Set oDoc = oWord.Documents.Add
'****************
With oWord.Selection
.TypeParagraph
.Font.Color = wdColorDarkBlue
.TypeText Text:="OFFICE DES CHANGES LE :"
.TypeText Date
.TypeParagraph
.TypeText Text:="DIVISION SYSTEME D'INFORMATION"
.TypeParagraph
.TypeParagraph
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Font.Color = wdColorDarkRed
.TypeText Text:="CONSULTATION DES AUTORISATIONS FINANCIERES SANS NOMS"
.TypeParagraph
.TypeParagraph
.ParagraphFormat.Alignment = wdAlignParagraphLeft
.Font.Color = wdColorBlack
.TypeText Text:="N°D'AUTORISATION :"
.Font.Color = wdColorRed
.TypeText MSFlexGrid1.TextMatrix(1, 0)
.TypeParagraph
.Font.Color = wdColorBlack
'.TypeText Text:="Date d'Autorisation :"
.Font.Color = wdColorRed
'.TypeText MSFlexGrid1.TextMatrix(1, 1)
.TypeParagraph
End With
'**************
For row = 0 To MSFlexGrid1.Rows - 1
n = 0
For col = 0 To MSFlexGrid1.Cols - 1
arr(I, n) = MSFlexGrid1.TextMatrix(row, col)
n = n + 1
Next
I = I + 1
Next
'ENregistrer sur un tableau
For I = LBound(arr, 1) To UBound(arr, 1)
For n = LBound(arr, 2) To UBound(arr, 2)
sTemp = sTemp & arr(I, n)
If n = UBound(arr, 2) Then
sTemp = sTemp & vbCrLf
Else
sTemp = sTemp & vbTab
End If
Next
Next
'Avoir l'emplacelent sur le document
Set oRange = oDoc.Bookmarks("\EndOfDoc").Range
oRange.Text = sTemp
'Convertire le format et le texte
oRange.ConvertToTable vbTab, Format:=wdTableFormatColorful2
Set oRange = Nothing
'***********************
survivorr
Messages postés10Date d'inscriptionlundi 6 mars 2006StatutMembreDernière intervention11 octobre 2007 15 mai 2006 à 15:32
Merci bcp Michel de ta reponse qui a résolu une partie de mon probleme, maintenant les colonnes sont affichées correctement mais j'en ai 10 colonnes ce qui fait lors de l'affichage il y a 3 colonnes qui ne s'affichent pas pcq la page n'est pas assez large.
Est-ce qu'il y a une possibilité pour afficher la page Word en largeur maximale par defaut ou sous format paysage
<?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" />