Pages

Monday, June 28, 2010

Print report without display c#

วันนี้พยายามที่จะสร้างใบส่งของ โดยที่เวลากดปุ่มแล้วให้มันพิมพ์รายการที่ต้องการส่ง

ปกติที่ผมเคยทำจะใช้ Reportviewer หรือไม่ก็ CrytalReport แต่ว่ามันจะต้องแสดงใน form ก็แล้วค่อยกดปริ้นทีหลัง

อีกวิธีคือ ใช้ Graphic.drawString เอาเลยแบบง่าย ๆ

แต่น่าจะมีวิธีที่ง่ายกว่านี้ก็คงต้องใช้ reportviewer ในการพิมพ์เลยแต่ไม่ต้องการให้มันแสดงใน form เนี่ยสิทำยังไงดี ก็เลยของหาใน google ไปเจอ tutorial ของ microsoftที่ http://msdn.microsoft.com/en-us/library/ms252091(VS.80).aspx แต่ก็ยังงงอยู่ดี เพราะตัว Report ที่ผมใช้เป็น version 2008 พอ build มันจะฟ้อง error

Error 2 The report definition is not valid. Details: The element 'ReportItems' in namespace 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition' has invalid child element 'Tablix' in namespace 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition'. List of possible elements expected: 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Line http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Rectangle http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Textbox http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Image http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Subreport http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:List http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Matrix http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Table http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Chart http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:CustomReportItem ##other:*'. C:\Users\wirat\Documents\Visual Studio 2008\Projects\Inventory\Inventory\Report1.rdlc Inventory

ซะเยอะเลย


No comments:

Post a Comment