npoi

导入导出

六月ゝ 毕业季﹏ 提交于 2019-11-30 03:11:45
Aspose.Cells Aspose.Cells是一款功能强大的Excel文档处理和转换控件,开发人员和客户电脑无需安装Microsoft Exacel也能在应用程序中实现类似 Excel的强大数据管理功能,支持所有Excel格式类型的操作,在没有Microsoft Excel的环境下,用户也可为其应用程序嵌入类似Excel的强大数据管理功能,在各个层面导入图像,应用复杂的计算公式,并将应用程序中的表格保存为各种格式等 NPOI NPOI是指构建在POI 3.x版本之上的一个长须 NPOI可以在没有安装Office的情况下对Word或Excel温昂进行读写操作,Npoi是一个开源的C#读写Excel Word等微软OLE2 组件文档的项目 Provider 驱动程序名称 Data Source 指定Excel文件的路径 Extented Properties:Excel 8.0 针对Excel 2000 及以上版本;Excel12.0针对Excel2007 以上版本 来源: https://www.cnblogs.com/Culley/p/11549709.html

NPOI操作excel

◇◆丶佛笑我妖孽 提交于 2019-11-29 23:39:23
一、首先引用NPOI用到的dll文件,有点多,但是都需要引用。 相关dll文件可以加群 582260284 获取。 二、具体实现代码如下 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using CaterBll; using CaterModel; using NPOI.HSSF.UserModel; using NPOI.HSSF.Util; namespace CaterUI.test { public partial class NPOITest : Form { public NPOITest() { InitializeComponent(); } /// <summary> /// 导出excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param>

npoi读取excel

随声附和 提交于 2019-11-29 17:20:20
npoi读取excel: 1.导入excel为datatable类型: private void button1_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = true;//该值确定是否可以选择多个文件 dialog.Title = "请选择文件夹"; dialog.Filter = "所有文件(*.*)|*.*"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string file = dialog.FileName; DataTable dt = ExcelToDataTable(file, false); } } /// <summary> /// 将excel导入到datatable /// </summary> /// <param name="filePath">excel路径</param> /// <param name="isColumnName">第一行是否是列名</param> /// <returns>返回datatable</returns> public DataTable ExcelToDataTable

Trying to edit cell value of existing Excel file using NPOI

为君一笑 提交于 2019-11-29 16:35:24
I have written the following code to edit an Excel file using C# and NPOI library. There are no errors, but after running the code if I open the file, the value of the cell is not edited. What am I doing wrong? namespace Project37 { class Class1 { public static void Main() { string pathSource = @"C:\Users\mvmurthy\Downloads\VOExportTemplate.xlsx"; FileStream fs = new FileStream(pathSource, FileMode.Open, FileAccess.ReadWrite); HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true); HSSFSheet sheet = (HSSFSheet)templateWorkbook.GetSheet("ImportTemplate"); HSSFRow dataRow = (HSSFRow)sheet

NPOI2.2.0.0实例详解(一)—NPOI的下载与引用

泪湿孤枕 提交于 2019-11-29 12:16:04
NPOI 2.2.0.0版本 :下载地址 http://npoi.codeplex.com/downloads/get/1476595 1.下载后的文件夹内容 2. 打开dotnet4【基于.NET4.0的版本】 内容 Assembly名称 模块/命名空间 说明 NPOI.DLL NPOI.POIFS OLE2/ActiveX文档属性读写库 NPOI.DLL NPOI.DDF 微软Office Drawing读写库 NPOI.DLL NPOI.HPSF OLE2/ActiveX文档读写库 NPOI.DLL NPOI.HSSF 微软Excel BIFF(Excel 97-2003, doc)格式读写库 NPOI.DLL NPOI.SS Excel公用接口及Excel公式计算引擎 NPOI.DLL NPOI.Util 基础类库,提供了很多实用功能,可用于其他读写文件格式项目的开发 NPOI.OOXML.DLL NPOI.XSSF Excel 2007(xlsx)格式读写库 NPOI.OOXML.DLL NPOI.XWPF Word 2007(docx)格式读写库 NPOI.OpenXml4Net.DLL NPOI.OpenXml4Net OpenXml底层zip包读写库 NPOI.OpenXmlFormats.DLL NPOI.OpenXmlFormats 微软Office

ASP.NET 存取EXCEL 使用NPOI相关小技巧

我与影子孤独终老i 提交于 2019-11-29 11:30:01
整理NPOI相关小技巧 Technorati 的标签: .Net,NPOI 1.删除row & 删除并将下方数据行上移 //EX:删除ROW(8) Sheet.RemoveRow(Sheet.GetRow(8)); //删除行并将下方行上移 //EX:将第8行往上移一行=移除第7行 Sheet.ShiftRows(8, Sheet.LastRowNum, -1); 2.Sheet Copy HSSFSheet newSheet = (HSSFSheet)workbook.CloneSheet(0); 3.style 设定EXCEL导出后保存格的模式 /// /// 设定导出Excel保存格框线 /// /// /// public HSSFCellStyle SetBorderStyle(HSSFCellStyle oStyle) { //设定保存格框线 oStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.THIN; oStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.THIN; oStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.THIN; oStyle.BorderTop = NPOI.SS.UserModel

NPOI导出EXCEL样式

风格不统一 提交于 2019-11-29 06:16:37
public void Export(DataRequest<ExportModel> request, DataResponse<dynamic> response) { try { var order = GetShopModel(request.ObjectData.guid); var newFile = Directory.GetCurrentDirectory() + "\\Export\\Order" + order.OrderDate + ".xls"; string p = System.IO.Path.GetDirectoryName(newFile); if (!System.IO.Directory.Exists(p)) System.IO.Directory.CreateDirectory(p); var ShopGid = order.ShopGid; string startTime = order.OrderDate.Split('~')[0] + " 00:00:00"; string endTime = order.OrderDate.Split('~')[1] + " 23:59:59"; using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.Write)) {

C# NPOI操作Excel

时光总嘲笑我的痴心妄想 提交于 2019-11-29 04:47:30
      using System.IO;       using NPOI.POIFS.FileSystem;       using NPOI.HSSF.Util;       using NPOI.HSSF.UserModel;       using NPOI.XSSF.UserModel        //新建Excel文件            IWorkbook workbook = new HSSFWorkbook();       //新建Sheet表 ISheet sheet = workbook.CreateSheet("Test Result");       //创建单元格样式和字体样式 IFont font = workbook.CreateFont(); ICellStyle style = workbook.CreateCellStyle();        //设置居中 style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.CenterSelection;       //设置内容垂直居中 style.VerticalAlignment = VerticalAlignment.Justify;        //字体加粗        font.Boldweight = short

Does NPOI have support to .xlsx format?

北城余情 提交于 2019-11-29 04:26:43
Will NPOI DLL recognize .xlsx file? Currently I'm using NPOI 1.2.5 version DLL for Microsoft Excel 97-2003, but I need to access Excel sheets of extension .xlsx also. Will NPOI support the above? Code snippet: static void Main(string[] args) { XSSFWorkbook xssfwb; using(FileStream file=new FileStream( @"C:\Users\347702\Desktop\Hello.xlsx", FileMode.Open, FileAccess.Read)) { xssfwb=new XSSFWorkbook(file); } ISheet sheet=xssfwb.GetSheet("sheet1"); sheet.GetRow(1048576); Console.WriteLine(sheet.GetRow(1048576).GetCell(0).StringCellValue); } Yes it does. NPOI 2.0 beta works. Here's a sample code

Edit existing Excel file C# npoi

我怕爱的太早我们不能终老 提交于 2019-11-29 02:17:37
I want to with a console application C# open an existing excel file and add content to it. NPOI 2.1.1.0 My first approach was simply to add a value to last cell figure I solved that it will solve my other problem. This will read the file correctly with the new content but it will not save it. Output: "Cannot access a closed file.". HSSFWorkbook hssfwb; using (FileStream file = new FileStream(@"c:\testfile.xls", FileMode.Open, FileAccess.ReadWrite)) { hssfwb = new HSSFWorkbook(file); ISheet sheet = hssfwb.GetSheetAt(0); IRow row = sheet.GetRow(0); sheet.CreateRow(row.LastCellNum); ICell cell =