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

相关推荐
stevewongbuaa1 小时前
一些烦人的go设置 goland
开发语言·后端·golang
撸码到无法自拔1 小时前
MATLAB中处理大数据的技巧与方法
大数据·开发语言·matlab
island13142 小时前
【QT】 控件 -- 显示类
开发语言·数据库·qt
sysu632 小时前
95.不同的二叉搜索树Ⅱ python
开发语言·数据结构·python·算法·leetcode·面试·深度优先
hust_joker2 小时前
go单元测试和基准测试
开发语言·golang·单元测试
wyg_0311133 小时前
C++资料
开发语言·c++
小机学AI大模型3 小时前
关于使用PHP时WordPress排错——“这意味着您在wp-config.php文件中指定的用户名和密码信息不正确”的解决办法
开发语言·php
臻一3 小时前
关于bash内建echo输出多行文本
开发语言·bash
步、步、为营3 小时前
C# 探秘:PDFiumCore 开启PDF读取魔法之旅
开发语言·pdf·c#·.net
小黄人软件4 小时前
【MFC】C++所有控件随窗口大小全自动等比例缩放源码(控件内字体、列宽等未调整) 20250124
开发语言·c++·ui·mfc