2008年2月3日 星期日

iTextSharp 加中文支援 (Chinese Support)

1. Include "iTextSharp" Library

Imports iTextSharp.text
Imports iTextSharp.text.pdf


2. Set Chinese Base Font

' KAIU.TTF - 繁體字 & SIMHEI.TTF - 簡體字
FontPath As String = "c:\windows\fonts\KAIU.TTF"
Dim bf As BaseFont = BaseFont.CreateFont(FontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED)
Dim fn As Font = New Font(bf, 10)


3. Example:

Dim tab As New PdfPTable(3)
Dim headerwidth() As Single = {50, 25, 25}
tab.SetWidths(headerwidth)
tab.HeaderRows = 1
tab.AddCell(New Paragraph("日期", fn))


Reference:
http://unruledboy.cnblogs.com/archive/2005/08/30/DataTable2PDF.html

2008年2月2日 星期六

iTextSharp

Crystal Report 好用但仍有很多限制, 用code寫pdf file可以更dynamic. 所以推介iTextSharp來做 Report.

iTextSharp網頁: http://itextsharp.sourceforge.net

2008年2月1日 星期五

ZedGraph

超級好用又免費Chart .net component!
http://www.codeproject.com/KB/graphics/zedgraph.aspx

下載: download