PDF export, display problem

Technical support for Spire.DataExport

Moderators: iceblue support, DataExport, Manager

PDF export, display problem

Postby marc2010 » Sat Feb 12, 2011 8:44 pm

Hello :D

I'm using SPIRE EXPORT PDF as I want to generate from a datagridview (VB.NET 2010) a pdf ... I'm doing it through a mysql database as I didn't find a way to do it directly !

so the code below saves the data written in the datagridview to the mysql bdd and then, it does an SQL to PDF with SPIRE export pdf
Code: Select all
'PrintDocument1.Print()
        Dim oleDbConnection1 = New MySqlConnection()
       
        Dim Server As String = "localhost"
        Dim Db As String = "PINF"
        Dim User As String = "root"
        Dim Pwd As String = ""

        oleDbConnection1.ConnectionString = "Server=" & Server & ";" _
        & "Uid=" & User & ";" _
        & "Pwd=" & Pwd & ";" _
        & " Database=" & Db & ";"
       
        Dim oleDbCommand1 As New MySqlCommand
        oleDbCommand1.Connection = oleDbConnection1
        oleDbConnection1.Open()
        For i = 0 To dgv.RowCount - 2

            oleDbCommand1.CommandText = "insert into ATL values ('" & dgv(0, i).Value & "', '" & dgv(1, i).Value & "', '" & dgv(2, i).Value & "', '" & dgv(3, i).Value & "', '" & dgv(4, i).Value & "', '" & dgv(5, i).Value & "', '" & dgv(6, i).Value & "')"
            oleDbCommand1.ExecuteScalar()

        Next


        Dim pdfExport1 As New Spire.DataExport.PDF.PDFExport()
        pdfExport1.PDFOptions.PageOptions.Orientation = 0
        pdfExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView
        pdfExport1.DataFormats.CultureName = "fr-FR"
        pdfExport1.DataFormats.Currency = "€"
        pdfExport1.DataFormats.DateTime = "d-M-yyyy"
        pdfExport1.DataFormats.Float = "g"
        pdfExport1.DataFormats.[Integer] = "g"
        pdfExport1.DataFormats.Time = "H:mm"
        pdfExport1.PDFOptions.HeaderFont.AllowCustomFont = True
        pdfExport1.PDFOptions.DataFont.AllowCustomFont = True
        pdfExport1.PDFOptions.FooterFont.AllowCustomFont = True
        pdfExport1.PDFOptions.TitleFont.AllowCustomFont = True
        pdfExport1.AutoFitColWidth = False
        pdfExport1.FileName = "sample1.pdf"
        pdfExport1.PDFOptions.DataFont.CustomFont = New System.Drawing.Font("Arial", 10.0F)
        pdfExport1.PDFOptions.FooterFont.CustomFont = New System.Drawing.Font("Arial", 10.0F)
        pdfExport1.PDFOptions.HeaderFont.CustomFont = New System.Drawing.Font("Arial", 10.0F)
        pdfExport1.PDFOptions.PageOptions.Format = Spire.DataExport.PDF.PageFormat.User
        pdfExport1.PDFOptions.PageOptions.Height = 11.67
        pdfExport1.PDFOptions.PageOptions.MarginBottom = 0.78
        pdfExport1.PDFOptions.PageOptions.MarginLeft = 1.17
        pdfExport1.PDFOptions.PageOptions.MarginRight = 0.57
        pdfExport1.PDFOptions.PageOptions.MarginTop = 0.78
        pdfExport1.PDFOptions.PageOptions.Width = 20
        pdfExport1.PDFOptions.TitleFont.CustomFont = New System.Drawing.Font("Arial", 10.0F)

        pdfExport1.PDFOptions.ColSpacing = 0
        pdfExport1.PDFOptions.RowSpacing = 2
        pdfExport1.PDFOptions.GridLineWidth = 2
        oleDbCommand1.CommandText = "select * from ATL"
        pdfExport1.Header.Text = "ATL"

        'pdfExport1.PDFOptions.TitleFont.CustomFont = New System.Drawing.Font("Arial", 20.0F, FontStyle.Bold)
        pdfExport1.SQLCommand = oleDbCommand1

        pdfExport1.SaveToFile()
        oleDbConnection1.Close()


But in the resulted PDF file .... the display is bad, I mean there are not all columns displayed ... and the columns are too spaced ! I don't know how to reduce the spacing of the columns .. if someone knows ..

here is an example of a resulted PDF with the code above :
Image
there are normally 7 columns .... I couldn't display the 7 columns without generating a small table (and as you see, the columns' name are superimposed), so we won't see anything as it would be small (the police), maybe if there is a way to not display the titles of the columns in one line, but 2-3 for example, it'd take lower place !.... :cry:
If someone has an idea...

thanks ! =)
marc2010
 
Posts: 1
Joined: Thu Feb 10, 2011 4:29 pm

Re: PDF export, display problem

Postby harry.support » Tue Feb 15, 2011 6:52 am

sorry, dataexport does not support custom column header at present.
You could use Spire.Doc, by which you can export you data to a document and convert it to pdf
please check http://www.e-iceblue.com/Introduce/word ... oduce.html to get more information about spire.doc
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar
harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm


Return to Spire.DataExport

Who is online

Users browsing this forum: No registered users and 1 guest

cron