-
Mar 1st, 2014, 09:13 AM
#1
Thread Starter
New Member
Print to PDF or Ms word Help!
Hi guys,
I am new to VB.Net and I've installed VS 2013.
I made a simple window form which takes two numeric parameters from user and after pressing calculate button result will show in 4 different Text Item based on Sum, Multiplication, Divide and Subtraction.
Now i want your help to create another Print button that would print result [4 Text Items] to PDF and Word file along with the desired logo, after pressing Print button it should also ask the user where to save your file.
Thanks in advance
-
Mar 1st, 2014, 12:42 PM
#2
Addicted Member
Re: Print to PDF or Ms word Help!
Try this
Code:
Private Sub Print_PreviewButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_PreviewButton.Click
'Note! There is overload of the PrintPreview
'method which accepts print settings (DGVEPrintSettings);
DGVEPrintManager.PrintPreview(Payroll_CalculatorDataGridView)
End Sub
Private Sub Print_ReportButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_ReportButton.Click
DGVEPrintManager.Print(Payroll_CalculatorDataGridView, cbpd.Checked) 'Note! There is overload of the Print
'method which accepts print settings (DGVEPrintSettings)
End Sub
Private Sub exporter_ExportFailed(ByVal sender As Object, ByVal e As CompletIT.Windows.Forms.Export.ExportFailedEventArgs)
'Show message box with the occured exception
MessageBox.Show(e.Exception.Message)
End Sub
Private Sub XportPDFButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles XportPDFButton.Click
'You can export any DataGridView control, no matter managed or not by the extension
Dim pdfExporter As DGVEPdfExporter = New DGVEPdfExporter()
Dim dialog As DGVEBaseExportSettingsEditorForm = DGVEExportSettingsEditorFormBuilder.CreateWrappingForm(pdfExporter)
dialog.Settings = New DGVEPdfExportSettings()
If (DialogResult.OK <> dialog.ShowDialog()) Then
Return
End If
AddHandler pdfExporter.ExportFailed, AddressOf exporter_ExportFailed
pdfExporter.Export(Payroll_CalculatorDataGridView, dialog.Settings)
End Sub
-
Mar 2nd, 2014, 06:41 AM
#3
Thread Starter
New Member
Re: Print to PDF or Ms word Help!
Originally Posted by ashveen
Try this
Code:
Private Sub Print_PreviewButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_PreviewButton.Click
'Note! There is overload of the PrintPreview
'method which accepts print settings (DGVEPrintSettings);
DGVEPrintManager.PrintPreview(Payroll_CalculatorDataGridView)
End Sub
Private Sub Print_ReportButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_ReportButton.Click
DGVEPrintManager.Print(Payroll_CalculatorDataGridView, cbpd.Checked) 'Note! There is overload of the Print
'method which accepts print settings (DGVEPrintSettings)
End Sub
Private Sub exporter_ExportFailed(ByVal sender As Object, ByVal e As CompletIT.Windows.Forms.Export.ExportFailedEventArgs)
'Show message box with the occured exception
MessageBox.Show(e.Exception.Message)
End Sub
Private Sub XportPDFButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles XportPDFButton.Click
'You can export any DataGridView control, no matter managed or not by the extension
Dim pdfExporter As DGVEPdfExporter = New DGVEPdfExporter()
Dim dialog As DGVEBaseExportSettingsEditorForm = DGVEExportSettingsEditorFormBuilder.CreateWrappingForm(pdfExporter)
dialog.Settings = New DGVEPdfExportSettings()
If (DialogResult.OK <> dialog.ShowDialog()) Then
Return
End If
AddHandler pdfExporter.ExportFailed, AddressOf exporter_ExportFailed
pdfExporter.Export(Payroll_CalculatorDataGridView, dialog.Settings)
End Sub
Thank you, I will check it with your code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|