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

相关推荐
Oneforlove_twoforjob15 分钟前
【Java基础面试题033】Java泛型的作用是什么?
java·开发语言
engchina32 分钟前
如何在 Python 中忽略烦人的警告?
开发语言·人工智能·python
向宇it32 分钟前
【从零开始入门unity游戏开发之——C#篇24】C#面向对象继承——万物之父(object)、装箱和拆箱、sealed 密封类
java·开发语言·unity·c#·游戏引擎
诚丞成1 小时前
计算世界之安生:C++继承的文水和智慧(上)
开发语言·c++
Smile灬凉城6661 小时前
反序列化为啥可以利用加号绕过php正则匹配
开发语言·php
lsx2024061 小时前
SQL MID()
开发语言
Dream_Snowar1 小时前
速通Python 第四节——函数
开发语言·python·算法
西猫雷婶1 小时前
python学opencv|读取图像(十四)BGR图像和HSV图像通道拆分
开发语言·python·opencv
鸿蒙自习室1 小时前
鸿蒙UI开发——组件滤镜效果
开发语言·前端·javascript
言、雲2 小时前
从tryLock()源码来出发,解析Redisson的重试机制和看门狗机制
java·开发语言·数据库