Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Tue Dec 20, 2011 9:30 am

Hi,

i need to print a simple title "Table Customers" before print my DataTable.

My code:
Code: Select all
Spire.DataExport.PDF.PDFExport pdfExport1 = new Spire.DataExport.PDF.PDFExport();
            pdfExport1.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            pdfExport1.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            pdfExport1.PDFOptions.PageOptions.Height = 13;
            pdfExport1.PDFOptions.PageOptions.Width = 13;
            pdfExport1.DataTable = dt;
            pdfExport1.SaveToFile(DateTime.Now.Millisecond + ".pdf");


second question:

i try to insert this code:
Code: Select all
pdfExport1.PDFOptions.DataFont.CustomFont = new System.Drawing.Font("Arial", 10F);
    pdfExport1.PDFOptions.FooterFont.CustomFont = new System.Drawing.Font("Arial", 10F);
    pdfExport1.PDFOptions.HeaderFont.CustomFont = new System.Drawing.Font("Arial", 10F);

before
Code: Select all
pdfExport1.DataTable = dt;
            pdfExport1.SaveToFile(DateTime.Now.Millisecond + ".pdf");


but the font is not changed, what can it be?

thanks :)

napalm
 
Posts: 4
Joined: Sun Nov 06, 2011 11:39 am

Tue Dec 20, 2011 9:52 am

ah sorry, for first question i found the answer:
Code: Select all
pdfExport1.Header.Add("Spire.DataExport Headers");


but i need to center the page and bold....

napalm
 
Posts: 4
Joined: Sun Nov 06, 2011 11:39 am

Wed Dec 21, 2011 6:14 am

Hi, Napalm

I am sorry for that Spire.DataExport doesn’t support center the title. We recommend you use Spire.PDF to achieve.
If you want to set font style, you need to add the following code:
Code: Select all
     
       pdfExport1.PDFOptions.HeaderFont.AllowCustomFont = true;
       pdfExport1.PDFOptions. DataFont.AllowCustomFont = true;
       pdfExport1.PDFOptions.FooterFont.AllowCustomFont = true;

I attached you complete demo. Please check it.

If you still have any other questions, please don't hesitate to contact us.
Have a nice day.
Attachments
Program.zip
(648 Bytes) Downloaded 1137 times
User avatar

Suvi.Wu
 
Posts: 154
Joined: Thu Oct 20, 2011 2:53 am

Wed Dec 21, 2011 9:28 am

Thanks for the support Suvi.Wu, i fix my problem.

Another question: you can make sure that the width of the cells is dynamic so that the table does not leave the page as is happening to me?
Attachments
pdf.gif
pdf.gif (28.04 KiB) Viewed 10633 times

napalm
 
Posts: 4
Joined: Sun Nov 06, 2011 11:39 am

Thu Dec 22, 2011 3:40 am

Hi, Napalm

Sorry for the inconvenience caused by us.

Spire.DataExport doesn’t support set the column width. It will set the column width automatically. You can set page size to resolve the problem you came up with. Please try to modify the following code in your project.

Code: Select all
   
pdfExport1.PDFOptions.PageOptions.Height = 18;
pdfExport1.PDFOptions.PageOptions.Width = 18;


If you still have any other doubts, please feel free to contact us.
Have a nice day.
User avatar

Suvi.Wu
 
Posts: 154
Joined: Thu Oct 20, 2011 2:53 am

Thu Dec 22, 2011 8:07 am

Thanks Suvi, Have a nice day to you :)

napalm
 
Posts: 4
Joined: Sun Nov 06, 2011 11:39 am

Return to Spire.DataExport