這里用的是FastReport 設計的模板,直接調用FastReport模板。
1.先引入FastReport.dll文件。
2.就以打印一個簡單的物品包裝條碼為例。
2.1設計
這個很簡單了,基本和VS開發工具是一樣的。只是它的參數是這樣定義的。
然后打開,選擇PCode雙擊 OK。
2.2代碼
Report report = new Report();
string MFile = @"C:\Users\Sunp\Desktop\test.frx";//FastReport設計后的文件保存的路徑。
if (File.Exists(MFile))
{
report.Load(MFile);
}
report.SetParameterValue("PCode", txtMBarCode.Text);//給參數賦值(條碼)
report.PrintSettings.ShowDialog = false;//不彈出打印設置框
//打印
report.Print();
////預覽
//report.Prepare();
//report.ShowPrepared();
report.Dispose();
哈哈,簡單吧。小弟初來咋到,以后請各位牛牛們幫幫忙,哪里有不對之處,多多提醒哈。小弟在這里先說聲謝謝了。。。