Showing posts with label Crystal Report. Show all posts
Showing posts with label Crystal Report. Show all posts

Monday, May 12, 2014

ASP.NET กับ Crystal Report เรื่อง ปัญหาขนาด font


สำหรับ ASP.NET ที่เราพัฒนากันนั้น ส่วนใหญ่ (เกือบ 100%) คงได้ใช้ Crystal Report ช่วยในการทำเอกสาร หรือ รายงาน กัน

และเมื่อแสดงผลรายงานทาง Web Browser ตัว ASP.NET Crystal Report โดย Default จะทำการแปลงรายงานไปเป็น PDF ไฟล์แล้วจึงแสดงบน Web Browser

ปัญหาก็คือ ตัว Engine ของ Crystal Report ขณะที่มันแปลงรายงานไปเป็น pdf นั้น มันทำการลดขนาดของ font ลงไปด้วย ทำให้พบปัญหาขนาดตัวอักษรที่ได้ออกแบบไว้ใน Designer กับตอนรันออกมา มีผลลัพธ์ไม่เหมือนกัน

วิธีการแก้ไข จะต้องแก้ไขที่ registry ของเครื่อง Developer (เมื่อนำขึ้น Production ก็ต้องทำที่เครื่อง Web Server ด้วยนะครับ) ดังนี้

** ขอบคุณ jbkumar จาก forums.asp.net/ สำหรับวิธีการแก้ไขนี้ครับ **
To fix the bug, just follow steps below by adding 2 registry keys.

1. Select Start > Run. Type regedit and click OK.

2. For Crystal Reports 2008, Expand HKEY_CURRENT_USER\Software\Business Objects\Suite 12.0\Crystal Reports\Export.

For Crystal Reports 11.0, Expand HKEY_CURRENT_USER\Software\Business Objects\Crystal Reports.

For Crystal Reports 10.0, Expand HKEY_CURRENT_USER\SOFTWARE\Crystal Decisions\10.0\Crystal Reports\Export

For Crystal Reports 9,0, Expand HKEY_CURRENT_USER\software\crystal decisions\9.0\Crystal Reports\Export

3. Right-click the Export folder and select New > Key. This creates a new folder. Name the new folder PDF.

4. Right-click the PDF folder and select New > DWORD Value.

5. Name this 'ForceLargerFonts' with no quotes and note that it is case sensitive.

6. Double-click ForceLargerFonts and change the Value data to 1 and click OK.

7. Close all the registry folders and expand the following registry For Crystal Reports 2008, HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 12.0\Crystal Reports.

For Crystal Reports 11.0, HKEY_LOCAL_MACHINE\Software\Business Objects\Suite 11.0.

For Crystal Reports 10.0, HKEY_LOCAL_MACHINE\SOFTWARE\Crystal Decisions\10.0\Crystal Reports

For Crystal Reports 9.0, HKEY_LOCAL_MACHINE\Software\Crystal Decisions\9.0\Crystal Reports

8. Right-click the Crystal Reports folder and select New > Key. Name this key Export.

9. Right-click the Export folder and select New > Key. This creates a new folder. Name this folder PDF.

10. Repeat steps 4 through 6.

11. Close the Registry Editor and restart Crystal Reports.


After adding these two registry keys, Crystal Reports won't have this font size problem any more.

************* สำหรับตอน Deploy ขึ้น IIS Server ให้ทำแบบนี้แทนครับ *************
Credit: http://www.morovia.com/kb/Font-size-decreases-exporting-PDF-Crystal-Reports-10053.html

 เมื่อแก้ไข Register แล้ว ให้ restart IIS service ด้วยครับ


////////// NooM ///////////

Sunday, March 3, 2013

Crystal Report for Visual Studio 2010

For Visual Studio 2010 development.
When you add a new crystal report item into your Visual Studio Solution/Projects, it will display following screen:

 

You would like to download the packs from http://scn.sap.com, then just install it.



Wednesday, February 6, 2008

CRAXDRT Error Occured on Server. - 2147467259

วันนี้ผมได้ช่วยพี่คนหนึ่งซึ่งพบ Error ขณะกำลัง Export ข้อมูลจาก Crystal Report
โดยเป็นโปรแกรมที่ run อยู่บน asp page ซึ่ง Error ที่พบคือ

CRAXDRT Error Occurred on Server, -2147467259 : 006~ASP 0251~Response Buffer Limit Exceeded~Execution of The ASP page caused the Response Buffer to exceed its configured limit.

ผมลองค้นหาจากแหล่งต่างๆ และพบผู้บอกวิธีแก้ไขไว้ ดังนี้ (กระผมขออนุญาตยกมาทั้งข้อความเลยครับ)

CRAXDRT Error Occured On Server
CRAXDRT Error Occured On Server. - 2147467259 : 006~ASP 0251~Response Buffer Limit Exceeded~Execution of the ASP page caused the Response Buffer to exceed its configured limit.

Cannot export report into word file which contains a large amount of data. Cannot import Crystal Reports related to Agent and Skillset performance.

CRAXDRT Error Occurred on Server, -2147467259 : 006~ASP 0251~Response Buffer Limit Exceeded~Execution of The ASP page caused the Response Buffer to exceed its configured limit.

Request object error 'ASP 0104 : 80004005'

Operation not allowed.
/Reporting/Historical/outputfile.asp, line 223

Cause:
By default, Microsoft Internet Information Services (IIS) 6.0 sets the value of the AspMaxRequestEntityAllowed and AspBufferingLimit metabase key to 204,800 bytes.

Fix:
Edit the metabase.xml using Notepad and increase the values for AspMaxRequestEntityAllowed and AspBufferingLimit. For example, setting to 1073741824 will increase the file size to 1 GB.

Posted by lam at April 1, 2007 04:22 PM


แหล่งที่มา www.movement3.com (http://www.movement3.com/b/archives/2007/04/craxdrt_error_o.php)


ผมขออธิบาย ดังนี้
1. เนื่องจาก IIS6.0 ซึ่ง run อยู่บน Windows Server 2003 กำหนด buffer ไว้เพียง 4 MB (4194304) เท่านั้น
2. เดิมโปรแกรมนี้ run บน IIS5.0 บนหครื่อง Windows 2000 ซึ่งไม่พบปัญหา (ผมยังไม่มีเวลาไปดูว่าใน IIS5.0 มันกำหนด buffer ไว้เท่าไร)

แนวทางแก้ไข
1. เปิด IIS6.0 ขึ้นมา
2. คลิกขวาที่ Web Server(local computer) เลือก properties
3. ที่หน้าต่าง Web Server(local computer) Properties ให้คลิกเลือก "Enable Direct Metabase Edit"
4. กดปุ่ม Apply และ กดปุ่ม OK
5. เข้าไปยัง C:\WINDOWS\system32\inetsrv และเปิดไฟล์ชื่อ metabase.xml โดยใช้ NotePad
6. ค้นหาคำว่า AspBufferingLimit
7. แก้ไขค่าจาก 4194304 เป็นค่าที่เราต้องการ เช่น 15728640 (15 MB)
8. เลือก File --> Save
9. ปิด NotePad
10. ทำข้อ 1-2 อีกครั้ง แต่คราวนี้ให้เอาเครื่องหมายถูกหน้า "Enable Direct Metabase Edit" ออก
11. เสร็จพิธีกรรม นอนหลับฝันดี

ขอขอบคุณ lam จาก movement3.com ที่ได้เคย post ไว้เพื่อให้ผมได้เข้ามาหาทางออกได้
และขอบคุณคุณ MR.L สำหรับข้อมูลพาธไฟล์ที่ผมได้รู้จากกระทู้ของคุณ (http://greatfriends.biz/webboards/msg.asp?id=56100)