C# winform 打印Excel

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

相关推荐
2201_7576799837 分钟前
QT学习第五天
开发语言·qt·学习
tanzongbiao2 小时前
身份证阅读器API模式 VUE Dorado7
开发语言·javascript·ecmascript
凡人的AI工具箱2 小时前
AI教你学Python 第4天:函数和模块
开发语言·人工智能·python·aigc
努力进修3 小时前
欢迎来到我的Java世界“抽象类”
java·开发语言·python
Lilixy.18233 小时前
【Java-反射】
java·开发语言
ERIC-ZI5 小时前
Segger Embedded Studio 的使用
开发语言
lzb_kkk5 小时前
【Redis】redis5种数据类型(list)
开发语言·数据库·redis
bingo6916 小时前
Qt-常用控件(3)-多元素控件、容器类控件和布局管理器
开发语言·qt
蒙娜丽宁6 小时前
深入探讨Go语言中的切片与数组操作
开发语言·后端·golang·go
雾岛LYC听风6 小时前
3. 轴指令(omron 机器自动化控制器)——>MC_HomeWithParameter&MC_Move
运维·c#·自动化