Impression MSChart

Loulou - 18 juin 2001 à 19:04
 dick - 2 oct. 2001 à 16:34
Comment je peus imprimer mon MSChart ???

:question)

2 réponses

Salut,

Je suis dans le meme cas que toi. mais voyant la date de ton message, tu as peut etre trouver une solution depuis. c'est pourquoi si tu as une solution, pourrait tu me la faire parvenir. Mon e-mail est franck.goubier@freesbee.fr

Merci d'avance.
0
Salut,

Je ne sais pas si tu en as toujours besoin, mais je vient enfin de trouver la solution pour imprimer un MSChart, la voici :

Tout d'abord, il faut ajouter un PictureBox invisible avec autodraw = true dans la form.

Const strFileName As String = "MongraphFI" ' Nom du fichier généré

'permet d'avoir la PictureBox et le MSChart toujours à la meme taille que la feuille

Sub Form_Resize()

On Error Resume Next

With Picture1

Picture1.Width = GraphIntByFra1.ScaleWidth
Picture1.Height = GraphIntByFra1.ScaleHeight
Picture1.Top = GraphIntByFra1.ScaleTop
Picture1.Left = GraphIntByFra1.ScaleLeft

End With

With MSChart1

MSChart1.Width = GraphIntByFra1.ScaleWidth
MSChart1.Height = GraphIntByFra1.ScaleHeight
MSChart1.Top = GraphIntByFra1.ScaleTop
MSChart1.Left = GraphIntByFra1.ScaleLeft

End With

End Sub

Private Sub Imprimer_Click()

Dim intBegin As Integer, intEnd As Integer

On Error GoTo dbErrHandler
cbdPrint.ShowPrinter
intBegin = cbdPrint.FromPage
intEnd = cbdPrint.Copies

' Génération du fichier HTML
Call GenHtml

Printer.EndDoc

Exit Sub

dbErrHandler:
Exit Sub

End Sub

Private Sub GenHtml()
Dim nFile As Integer

' Sauvegarde de l'image
MSChart1.EditCopy
Call SavePicture(Clipboard.GetData, App.Path & "" & strFileName & ".bmp")
' On efface le clipboard
Clipboard.Clear
Picture1.Picture = LoadPicture(App.Path & "" & strFileName & ".bmp")
Printer.PaintPicture Picture1.Image, 0, 0

End Sub
0
Rejoignez-nous