MemberManagement/Utils.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MemberManagement
{
public static class Utils
{
public static void ControlReset(this Form frm, bool clearMsg = true)
{
List<string> ctlNameList = new List<string>() { "nudAmount", "txtCard1" };
foreach (Control ctl in frm.Controls)
{
if (ctlNameList.Contains(ctl.Name))
{
continue;
}
if (ctl is TextBox)
{
((TextBox)ctl).Text = String.Empty;
}
else if (ctl is NumericUpDown)
{
((NumericUpDown)ctl).Value = 0;
}
else if (ctl is Label)
{
if (ctl.Name == "labToast" && clearMsg)
((Label)ctl).Text = String.Empty;
}
}
}
//传入DataGridView
/// <summary>
/// 输出数据到Excel
/// </summary>
/// <param name="dataGridView">DataGridView</param>
/// <param name="includeHeader">是否包含字段名</param>
/// <param name="savePath">保存路径</param>
/// <returns>成功TRUE/失败FALSE</returns>
public static bool ExportExcel(DataGridView dataGridView, bool includeHeader, string savePath, string statistics)
{
bool succeed = true;
try
{
//创建工作薄
IWorkbook wbook = null;
//创建工作表
ISheet sheet = null;
wbook = ICreateIWorkBook(savePath, null);
sheet = wbook.CreateSheet("Sheet1"); //创建工作表
后面还有 171 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。