เนื่องจากการทำรายงานด้วย Extrareport จะต้องมีการเพิ่มอักษร Sarabun ลงไปเพื่อให้รายงานสามารถแสดงผลอักษรได้อย่างถูกต้องโดยที่เครื่อง client ที่ไม่มีอักษร Sarabun ก็สามารถที่จะแสดงผลได้ วิธีทำมีดังนี้
1. Download Font TH SarabunPSK และนำไปไว้ในฟอเดอร์ fonts (ถ้าไม่มีฟอเดอร์นี้ให้สร้างขึ้นมา)
2. สร้าง ExtraReport ขึ้นมาและในส่วนของ ExtraReport.cs (CodeBehide c#) จะต้องเพิ่มโค้ดลงไป
public XtraReportInvite()
{
InitializeComponent();
//
// TODO: Add constructor logic here
//
//****** 1
Report.Font = new Font(FontCollection.Families[0], 48F, FontStyle.Regular, GraphicsUnit.Point);
}
//****** 2
static PrivateFontCollection fontCollection;
public static FontCollection FontCollection
{
get
{
if (fontCollection == null)
{
fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(HttpContext.Current.Server.MapPath("~/fonts/THSarabunPSK.ttf"));
}
return fontCollection;
}
}
รูปภาพประกอบในข้อที่ 1,2

3. ในส่วนของหน้า report.aspx ที่ไว้แสดง extrareport จะต้องใส่ @font-face ในส่วนของ css style ด้วย
<style>
@font-face {
font-family: 'TH SarabunPSK';
src:
url('./fonts/THSarabunPSK.eot?') format('embedded-opentype'),
url('./fonts/THSarabunPSK.woff') format('woff'),
url('./fonts/THSarabunPSK.ttf') format('truetype');
}
</style>

