
NPOI
m0_37565924
本人从事ArcEngine相关二次开发
展开
-
NPOI实现Word插入段落
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); XWPFParagraph para = fileWord.CreateParagraph(); XWPFRun xr = para.CreateRun(); xr.FontSize = 12; xr.SetText("段...原创 2021-04-16 15:15:02 · 1511 阅读 · 2 评论 -
NPOI实现Word复制表格
public static void CopyTable(XWPFDocument fileWord, int sourceIndex, int targetIndex) { var sourceTable = fileWord.Tables[sourceIndex]; CT_Tbl sourceCTTBl = fileWord.Document.body.GetTblArray(1); var targetTabl...原创 2021-04-16 15:12:53 · 1869 阅读 · 2 评论 -
NPOI实现Word删除表格
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); //获取到第一个表格 XWPFTable table = fileWord.Tables[0]; int tablesIndex = fileWord.GetPosOfTable(table); fileWord.Remo...原创 2021-04-16 15:07:47 · 931 阅读 · 0 评论 -
NPOI实现Word表格单元格赋值
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); //获取到第一个表格 XWPFTable table = fileWord.Tables[0]; //获取到第一行 XWPFTableRow row = table.Row[0]; //获取到第一个单元...原创 2021-04-16 15:05:58 · 872 阅读 · 0 评论 -
NPOI实现Word段落查找替换
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); foreach (var search in fileWord.Paragraphs) { string searchText = search.Text; if (searchText == "你要查找的...原创 2021-04-16 15:01:02 · 1376 阅读 · 0 评论 -
NPOI实现Word表格单元格合并
public void MergeCellsCustom(XWPFTable table, int startColumn, int endColumn, int startRow, int endRow) { for (int rowIndex = startRow; rowIndex <= endRow; rowIndex++) { if (startColumn < endCol...原创 2021-04-16 14:56:54 · 1205 阅读 · 1 评论 -
NPOI实现Word表格删除一行
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); //获取到第一个表格 XWPFTable table = fileWord.Tables[0]; //移除表格的第一行 table.RemoveRow(0);...原创 2021-04-16 14:52:09 · 799 阅读 · 0 评论 -
NPOI实现Word表格单元格赋值
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); //获取到第一个表格 XWPFTable table = fileWord.Tables[0]; //新建一行(在表格的最后一行插入) XWPFTableRow newRow = table.CreateRow(); ...原创 2021-04-16 14:49:44 · 572 阅读 · 0 评论 -
NPOI实现Word表格新增一行
XWPFDocument fileWord = null; fileWord = new XWPFDocument("要打开的word文件"); //获取到第一个表格 XWPFTable table = fileWord.Tables[0]; //新建一行(在表格的最后一行插入) XWPFTableRow newRow = table.CreateRow(); ...原创 2021-04-16 14:46:14 · 1548 阅读 · 0 评论 -
NPOI实现打开Word并保存
MemoryStream memory = new MemoryStream(); string dataWord = "路径"; XWPFDocument fileWord = null; using (FileStream fileStream = new FileStream(dataWord, FileMode.Open, FileAccess.Read)) { ...原创 2021-04-16 14:40:48 · 866 阅读 · 0 评论