DBgridに表示されているデータをPDFファイルにエクスポートするにはどうしたらいいですか?DatagridのPDFへのエクスポート
答えて
DBGridに表示されるデータは、そのdbgridに添付されたデータセットによって提供されるため、DBGridのデータをPDFにエクスポートすると、データセット内のデータをPDFにエクスポートすることを意味します。
最も簡単なオプションは、レポートツールを使用することです。たとえば、Delphiで利用可能なさまざまなレポートツールがあります。 Rave Report、FastReport、Report Builder、QuickReportなどがあります。
このようなツールを使用すると、データから印刷レポートを作成し、レポートを印刷したり、HTML、DOC、PDFなどの形式にエクスポートすることができます。 Rave ReportはDelphiに同梱されており、無料で使用できます。私は個人的にFastReportが好きで、私のアプリケーションでそれを使います。
もう1つの方法として、ターゲットシステムに仮想PDFプリンタがインストールされている場合、それをプリンタとして選択し、DelphiのTPrinterクラスを使用してプリンタキャンバスに直接書き込むことができます。仮想PDFプリンタはPDFファイルを作成する必要はありません。
第3のオプションは、特にPDF操作用に構築されたサードパーティのコンポーネントを使用して、アプリケーションでPDFファイルを作成または編集できるようにすることです。
よろしく
17の最も人気のあるフォーマットにEMS高度なデータエクスポートVCL
http://sqlmanager.net/en/products/tools/advancedexport
- データ(データセット)の輸出をしてみてください:MSアクセス、MSエクセル、MSワード、Open XML形式、 Open Document Format(ODF)、RTF、HTML、XML、PDF、TXT、DBF、CSV、SYLK、DIF、LaTeX、SQLおよびWindowsクリップボード
- Borland Delphi 5-7,2005,2006、CodeGear Delphi 2007、2009およびBorland C++ Builder 5-6、C odeGear C++ Builder 2007,2009のサポート
- Unicodeデータのエクスポート。エクスポートされたデータ(UTF-8、UTF-16/UCS-2、UTF-32/UCS-4、Latin1、Latin2、Latin5、Latin7など)のテキストエンコードを手動でプリセットする
- 将来の表示、変更、印刷のためのデータの保存またはWeb出版 ウィザードでは、エンドユーザーが各データ形式
- 100%ネイティブのDelphiコード
- 動作させるために必要な追加のライブラリやソフトウェアの迅速
- パワフルなエクスポートオプションデータをエクスポートすることができます簡単に使用
- 詳細なヘルプシステムとデモアプリケーション
- の強力なコンポーネントとプロパティエディタ
- 個別に各フィールドのユーザフォーマットを設定する多言語サポート
あなたは、データを介して自分自身を反復処理し、Gnosticeから優れた輸出VCL eDocEngine を使用することができます。また、レポートツールやその他のコンポーネントにも接続します。
価格は$ 199から開始します。http://www.gnostice.com/edocengine_vcl.asp – Mawg
Public Sub ExportDataTableToPDF(ByVal dtImport As DataTable)
Dim strQuery As String = "select er_num,er_shortd,er_longd,er_severity from mv_error"
Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)
Try
'====================================================================
'Dim str As String = DateTime.Now.ToString("yyyyMMddHHmmssff")
'Dim sWebSettingPath As String = ConfigurationSettings.AppSettings("ExptLoctPath")
'Dim str1 As String = "E:\ExportPdf_File"
'Dim WorkingFile As String
'Dim s As String
'If (Directory.Exists(sWebSettingPath)) Then
' s = "already exists"
' WorkingFile = Path.Combine(sWebSettingPath, "" & str & " DataTestData.pdf")
'Else
' Dim ss As String = "C:\ReportPDF"
' WorkingFile = Path.Combine(str1, "" & str & " DataTestData.pdf")
' Directory.CreateDirectory(ss)
'End If
'====================================================================
'Folder Exists in Particular folder or not cheak ifnot create a folder
Dim strDateTime As String = DateTime.Now.ToString("yyyyMMddHHmmssff")
Dim sWebSettingPath As String = ConfigurationSettings.AppSettings("ExptLoctPath")
Dim str1 As String = "E:\ExportPdf_File"
Dim WorkingFile As String
Dim s As String
If (Directory.Exists(sWebSettingPath)) Then
s = "already exists"
WorkingFile = Path.Combine(sWebSettingPath, "" & strDateTime & "_DataTestData.pdf")
Else
Dim sWebStingNotPath As String = "C:\ReportPDFTest"
Directory.CreateDirectory(sWebStingNotPath)
WorkingFile = Path.Combine(sWebStingNotPath, "" & strDateTime & " DataTestData.pdf")
End If
'====================================================================
Dim fs As New FileStream(WorkingFile, FileMode.Create, FileAccess.Write, FileShare.None)
'Create Document class object and set its size to letter and give space left, right, Top, Bottom Margin
PdfWriter.GetInstance(doc, fs)
' Dim wri As PdfWriter = PdfWriter.GetInstance(doc, New FileStream("C:\Documents and Settings\lessly.l\Desktop\iTextSharp\Test11.pdf", FileMode.Create))
doc.Open()
'Open Document to write
Dim font8 As Font = FontFactory.GetFont("ARIAL", 7)
'Write some content
Dim paragraph As New Paragraph("Team :: CataPult")
Dim dt As DataTable = dtImport
If dt IsNot Nothing Then
'Craete instance of the pdf table and set the number of column in that table
Dim PdfTable As New PdfPTable(dt.Columns.Count)
Dim PdfPCell As PdfPCell = Nothing
Dim pdfrow As PdfPRow = Nothing
For column As Integer = 0 To dt.Columns.Count - 1
PdfTable.HeaderRows = dt.Columns.Count
PdfPCell = New PdfPCell(New Phrase(New Chunk(dt.Columns(column).Caption.ToString().ToUpper, New Font(Font.HELVETICA, 8.0F, Font.BOLD, Color.WHITE))))
PdfPCell.BackgroundColor = New Color(System.Drawing.ColorTranslator.FromHtml("#66CCFF"))
PdfTable.AddCell(PdfPCell)
Next
'Each Row Values added
For rows As Integer = 0 To dt.Rows.Count - 1
For column As Integer = 0 To dt.Columns.Count - 1
PdfTable.HeaderRows = dt.Columns.Count
PdfPCell = New PdfPCell(New Phrase(New Chunk(dt.Rows(rows)(column).ToString(), font8)))
PdfTable.AddCell(PdfPCell)
Next
Next
PdfTable.SpacingBefore = 15.0F
' Give some space after the text or it may overlap the table
doc.Add(paragraph)
' add paragraph to the document
' add pdf table to the document
doc.Add(PdfTable)
End If
Catch docEx As DocumentException
'handle pdf document exception if any
Catch ioEx As IOException
' handle IO exception
Catch ex As Exception
' ahndle other exception if occurs
Finally
'Close document and writer
doc.Close()
End Try
End Sub
あなたのコードが何をしているのか、*なぜ*あなたがそれを推薦するのか、*どのように結論に至ったのか、細かい説明を加えてください。 =)また、コメントアウトされたコードがいっぱいです。それは本当に必要なの? –
OPはVisual Basicではなく、Delphiでソリューションを求めました。私は彼が手動でこれを変換する_could_(もしそうなら、ここに投稿してください、ありがとう) – Mawg
- 1. DataGridのPDFエクスポート
- 2. DataGridデータをPDFにエクスポート
- 3. VaadinのPDFへのエクスポート
- 4. DataGridをPDFにエクスポートするC#
- 5. Excel Fom DataGrid VB.Net Windowsアプリケーションへのエクスポート
- 6. 剣道UIのPDFへのエクスポート
- 7. Excel VBAのエクスポートとPDFへの添付
- 8. PDFへのGephiのエクスポートでノードラベルがエクスポートされない
- 9. DataGridを.xlsおよび/または.pdfにエクスポートする方法?
- 10. DataGridへのカレンダー
- 11. JasperViewerの使用:pdfとExcelへのエクスポートが無効
- 12. ExcelワークシートのPDFへのエクスポートを自動化
- 13. JasperReports、PDFへのエクスポート、空白の新しい行
- 14. SSRSレポートのPDF、EXCEL、およびMS-Word形式へのエクスポート
- 15. DataGridへのDbDataReader WPF
- 16. WPF MVVM DataGridから別のDataGrid行へ
- 17. データテーブルのエクスポートPDFのスタイル
- 18. DXChart WPFエクスポートPDF
- 19. レポートビューアランドスケープpdfエクスポート
- 20. PDFファイルにエクスポート
- 21. SmartGWT pdfエクスポート
- 22. DataList to PDFエクスポート
- 23. primefaces pdfエクスポート - ページサイズ
- 24. angularJSのロゴ付きpdfへ剣道図をエクスポート
- 25. spark-highchartsファイルへのエクスポート(pngまたはpdf)
- 26. コマンドラインでPDFからEMFへのInkscapeエクスポート(出力が空白)
- 27. ASP.Net MVCのエクスポートWebGridをPDF
- 28. 剣道エディタのpdfエクスポート
- 29. iOS - 複数のPDFをエクスポート
- 30. pdfエクスポートのデザインエラー - Dompdf/tcpdf
$ 195からですが、うまく見えます。まだ無料のソリューションを探しています;-) – Mawg