Nanda's Blog

Share a smile, Share information

Membuat Data Pada Ultragrid Ke dalam Bentuk PDF dan Print Preview October 26, 2010

Visual Basic 2008

Keterangan :

Ultragrid = UltraGrid1

button pdf = button_pdf

button preview = button_preview

UltraGrid Document Exporter = UltraGridDocumentExporter1

Private Sub button_preview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles button_preview.Click
UltraGrid1.PrintPreview()
End Sub

Private Sub button_pdf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_pdf.Click
‘ AutoSize the grid columns and rows when exporting
Me.UltraGridDocumentExporter1.AutoSize = Infragistics.Win.UltraWinGrid.DocumentExport.AutoSize.SizeColumnsAndRowsToContent

‘ Use a file buffer
Me.UltraGridDocumentExporter1.UseFileBuffer = True

‘ Specify a file instead of letting the control use the temp folder.
Dim bufferFileName As String = Path.Combine(Application.StartupPath, “ExportFileBuffer.tmp”)
Me.UltraGridDocumentExporter1.FileBuffer = bufferFileName

‘ Set the target paper orientation, size, and margins
Me.UltraGridDocumentExporter1.TargetPaperOrientation = PageOrientation.Portrait
Me.UltraGridDocumentExporter1.TargetPaperSize = PageSizes.Legal

‘ Export the grid to a PDF file.
Dim exportFileName As String = Path.Combine(Application.StartupPath, “Document Grid.pdf”)
Me.UltraGridDocumentExporter1.Export(Me.UltraGrid1, exportFileName, GridExportFileFormat.PDF)

‘ Launch the exported file in the appropriate reader.
Process.Start(exportFileName)
End Sub

dari berbagai sumber

 

 

One Response to “Membuat Data Pada Ultragrid Ke dalam Bentuk PDF dan Print Preview”

  1. stanley mahardhika Says:

    Kerennns abis .. cuma aku lg bingung nih nulis script load file *.txt ke mysql via vb 2008 .. gimana dong bisa bantu ?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s