WordTemplate

所属分类:C#编程
开发工具:C#
文件大小:11630KB
下载次数:8
上传日期:2020-03-05 15:25:32
上 传 者lockepeng
说明:  由于项目需求,需要根据现有的word模板,进行批量生成word报表,为了方便,选用的是 NPOI (NPOI是一个开源的C#读写Excel、WORD等微软OLE2组件文档的项目)来实现。本次用的版本是NPOI 2.3.0.0,版本不同写法会有差别。 思路 NPOI提供操作word文档的方法也比较简单。 替换模板中关键字的实现思路大致是: 获取具有关键字的模板word文档(关键字可以自己定义,需要具有唯一性和可读性); 获取文档中的所有段落Paragraphs(表格中的单元格内容也属于段落); 遍历段落,找到关键字并进行替换(表格需要先遍历单元格,再遍历单元格中的段落);
(Because of the project requirements, it is necessary to generate word reports in batches according to the existing word template. For convenience, npoi (npoi is an open source project of reading and writing excel, word and other Microsoft ole2 component documents) is selected for implementation. The version used this time is npoi 2.3.0.0, and there will be differences between different versions. thinking Npoi provides a simple way to operate word documents. The implementation idea of replacing keywords in the template is as follows: Get the template word document with keywords (keywords can be defined by themselves and need to be unique and readable); Get all paragraphs in the document (cell contents in the table also belong to paragraphs); Traverse the paragraph, find the keyword and replace it (the table needs to traverse the cell first, then the paragraph in the cell);)

文件列表:
WordTemplate (0, 2020-02-15)
WordTemplate\.vs (0, 2020-02-15)
WordTemplate\.vs\WordTemplate (0, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15 (0, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15\.suo (44032, 2020-02-19)
WordTemplate\.vs\WordTemplate\v15\Server (0, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15\Server\sqlite3 (0, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15\Server\sqlite3\db.lock (0, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15\Server\sqlite3\storage.ide (4096, 2020-02-15)
WordTemplate\.vs\WordTemplate\v15\Server\sqlite3\storage.ide-shm (32768, 2020-02-19)
WordTemplate\.vs\WordTemplate\v15\Server\sqlite3\storage.ide-wal (1685112, 2020-02-16)
WordTemplate\packages (0, 2020-02-15)
WordTemplate\packages\NPOI.2.4.1 (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\.signature.p7s (9471, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\lib\net40 (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\lib\net40\NPOI.dll (1624064, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net40\NPOI.OOXML.dll (530432, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net40\NPOI.OpenXml4Net.dll (89600, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net40\NPOI.OpenXmlFormats.dll (2078720, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net45 (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\lib\net45\NPOI.dll (1623552, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net45\NPOI.OOXML.dll (530432, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXml4Net.dll (89088, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXmlFormats.dll (2078720, 2018-12-17)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0 (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.deps.json (9461, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.dll (1666560, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OOXML.deps.json (10904, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OOXML.dll (532992, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OpenXml4Net.deps.json (9904, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OpenXml4Net.dll (89600, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OpenXmlFormats.deps.json (10396, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\netstandard2.0\NPOI.OpenXmlFormats.dll (2087936, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\lib\NPOI.xml (2271765, 2018-12-18)
WordTemplate\packages\NPOI.2.4.1\LICENSE (9851, 2017-03-21)
WordTemplate\packages\NPOI.2.4.1\logo (0, 2020-02-09)
WordTemplate\packages\NPOI.2.4.1\logo\120_120.jpg (8143, 2017-03-21)
WordTemplate\packages\NPOI.2.4.1\logo\240_240.png (15405, 2017-03-21)
WordTemplate\packages\NPOI.2.4.1\logo\32_32.jpg (1835, 2017-03-21)
... ...

近期下载者

相关文件


收藏者