|
 |
|
Export crystal report เป็นไฟล์ excel ไม่ได้ครับ ขึ้น error แบบนี้ ช่วยหน่อยครับ |
|
 |
|
|
 |
 |
|
ผมไม่สามารถแปลงไฟล์หรือ export จาก crystal report ไปเป็นไฟล์ excel ได้ครับ แต่ไฟล์นามสกุลอื่นสามารถทำได้ด้วยโค้ดคล้ายๆกัน ใช้โค้ดดังนี้
Code (C#)
string path = @"D:\output.xls";
try
{
BillingReportWithGraph rptg = new BillingReportWithGraph(); //ในโปรเจคท์มีไฟล์ .rpt
rptg.SetDataSource(billing); //main report แสดงตาราง
rptg.OpenSubreport("Chart").SetDataSource(graph); //sub report เป็นแสดงกราฟ
rptg.SetParameterValue("HeaderText", SystemParams.HeaderText); //other parameter
rptg.SetParameterValue("FooterText", SystemParams.FooterText); //other parameter
rptg.SetParameterValue("ReportName", SystemParams.ReportName); //other parameter
rptg.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, path); //start to export
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
ส่วนการ export ไปเป็นไฟล์ PDF, MS Word ก็ทำคล้ายๆกัน แค่เปลี่ยนนามสกุลไฟล์ตรง path เป็น .pdf และ .doc
และเปลี่ยนจาก CrystalDecisions.Shared.ExportFormatType.Excel เป็น
CrystalDecisions.Shared.ExportFormatType.WordForWindows สำหรับ MS Word
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat สำหรับ PDF
ก็สามารถทำได้ครับ
ผมเลยสงสัยว่ามันเป็นเพราะอะไร
มัน error ดังรูป

Tag : .NET, Ms SQL Server 2008, Crystal Report, Win (Windows App), C#, VS 2010 (.NET 4.x)

|
ประวัติการแก้ไข 2012-11-26 18:24:51 2012-11-26 18:43:34
|
 |
 |
 |
 |
Date :
2012-11-26 14:53:49 |
By :
snowbell |
View :
4899 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Export ออกมาเป็นไฟล์ Excel จากการกดปุ่ม export บน crystal report viewer ก็ไม่ได้ครับ เป็นเหมือนกัน
|
 |
 |
 |
 |
Date :
2012-11-26 15:01:55 |
By :
snowbell |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลบ Crystal Report ทุกเวอชั่นทิ้งให้หมด
แล้วลงเวอชันล่าสุดอีกที
|
 |
 |
 |
 |
Date :
2012-11-27 17:22:43 |
By :
me |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน vs2010 ผมติดตั้ง crystal report ตามลิงค์นี้ https://www.thaicreate.com/dotnet/install-crystal-report-for-visual-studio-2010.html
ซึ่งเป็นเวอร์ชัน 13
ถ้าอย่างนี้ผมต้องหาตัวไหนมาลงอะครับ ในเครื่อง client(เครื่องอื่น) ใช่ตัว runtime เวอร์ชั่น 13 หรือเปล่าครับ?
แล้วสามารถหาได้จากไหน เสียค่า license หรือไม่ เพราะใช้ในองค์กรครับ
|
ประวัติการแก้ไข 2012-11-28 14:59:07 2012-11-28 16:14:46
 |
 |
 |
 |
Date :
2012-11-28 14:58:12 |
By :
snowbell |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำได้แล้วครับ เพียงแต่มันทำที่เครื่องผมไม่ได้ ต้อง build แล้วไป install ที่เครื่องอื่น และลง crystal report runtime ที่เครื่องนั้น
|
 |
 |
 |
 |
Date :
2012-11-29 22:39:33 |
By :
snowbell |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|