C# winform 打印Excel

avatar
作者
猴君
阅读量:1

OfficeOpenXml.LicenseException
  HResult=0x80131500
  Message=Please set the ExcelPackage.LicenseContext property. See https://epplussoftware.com/developers/licenseexception
  Source=EPPlus
  StackTrace:
   at OfficeOpenXml.ExcelPackage.get_Workbook()
   at MangZhuan.Forms.FormException.printDocument1_PrintPage(Object sender, PrintPageEventArgs e) in E:\vsproject\MangZhuan\MangZhuan\Forms\FormException.cs:line 166
   at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)
   at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)
   at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
   at System.Drawing.Printing.PrintController.Print(PrintDocument document)
   at System.Drawing.Printing.PrintDocument.Print()
   at MangZhuan.Forms.FormException.btnPrint_Click(Object sender, EventArgs e) in E:\vsproject\MangZhuan\MangZhuan\Forms\FormException.cs:line 121
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at Sunny.UI.UIButton.OnClick(EventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Sunny.UI.UIControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at MangZhuan.Forms.FormRealAlarms.uiDataGridView1_CellContentClick(Object sender, DataGridViewCellEventArgs e) in E:\vsproject\MangZhuan\MangZhuan\Forms\FormRealAlarms.cs:line 92
   at System.Windows.Forms.DataGridView.OnCellContentClick(DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.OnCommonCellContentClick(Int32 columnIndex, Int32 rowIndex, Boolean doubleClick)
   at System.Windows.Forms.DataGridViewCell.OnMouseUpInternal(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellMouseUp(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at MangZhuan.Form1.btnTest_Click(Object sender, EventArgs e) in E:\vsproject\MangZhuan\MangZhuan\Form1.cs:line 823
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at Sunny.UI.UIButton.OnClick(EventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Sunny.UI.UIControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNative
 

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!