DotNet.WinForm/CommonModule/Utilities/BaseExportExcel.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2010 , Hairihan TECH , Ltd.
//------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using System.IO;
using System.Text;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System.Runtime.InteropServices;
namespace DotNet.WinForm
{
/// <summary>
/// BaseExportExcel
/// 导出Excel格式数据
///
/// 修改纪录
///
/// 2012.04.02 版本:3.0 Pcsky 增加判断文件是否打开的方法
/// 2012.04.02 版本:3.0 Pcsky 增加新的导出Excel方法,非Com+方式,改用.Net控件
/// 2009.07.08 版本:2.0 JiRiGaLa 更新完善程序,将方法修改为静态方法。
/// 2006.12.02 版本:1.0 JiRiGaLa 新创建。
///
/// <author>
/// <name>JiRiGaLa</name>
/// <date>2009.07.08</date>
/// </author>
/// </summary>
public class BaseExportExcel
{
#region private void DeleteExistFile(string fileName) 删除已经存在的文件
/// <summary>
/// 删除已经存在的文件
/// </summary>
/// <param name="fileName">文件路径</param>
private void DeleteExistFile(string fileName)
{
if (System.IO.File.Exists(fileName))
{
System.IO.File.Delete(fileName);
}
}
#endregion
#region public void GetExcelFile(DataTable result, string templateFilePath, string outFilePath, int startRowIndex, int startColIndex, string downloadPath) 导出Excel
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="result">数据表</param>
/// <param name="paramOutFileName">输出名称</param>
/// <param name="outFilePath">输出路径</param>
/// <param name="startRowIndex">粘贴起始行</param>
/// <param name="startColIndex">粘贴起始列</param>
/// <param name="downloadPath">下载路径</param>
public void GetExcelFile(System.Data.DataTable dt, string templateFilePath, string outFilePath, int startRowIndex, int startColIndex, string downloadPath)
{
后面还有 342 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
