docx

Manipulating and printing docx documents in C#

∥☆過路亽.° 提交于 2019-12-25 18:25:11
问题 I have developed an application in C#. I want to enable sers define their own print template for printing certificates. Currently it accepts html and replaces keywords with values. However users are not familiar with html design, converters do not give well designed result, and hand writing html code for getting the same design is time consuming. I want to enable my application to open the docx file, replace keywords with values and print. Any idea will be helpful. 回答1: Please check out

Apache poi get table from text box

好久不见. 提交于 2019-12-25 10:39:37
问题 I'm using apache poi for iteration table in docx file. All works fine but if table in text box , my code don't see table - table.size() = 0 XWPFDocument doc = new XWPFDocument(new FileInputStream(fileName)); List<XWPFTable> table = doc.getTables(); for (XWPFTable xwpfTable : table) { List<XWPFTableRow> row = xwpfTable.getRows(); for (XWPFTableRow xwpfTableRow : row) { List<XWPFTableCell> cell = xwpfTableRow.getTableCells(); for (XWPFTableCell xwpfTableCell : cell) { if(xwpfTableCell != null){

Apache poi get table from text box

佐手、 提交于 2019-12-25 10:35:10
问题 I'm using apache poi for iteration table in docx file. All works fine but if table in text box , my code don't see table - table.size() = 0 XWPFDocument doc = new XWPFDocument(new FileInputStream(fileName)); List<XWPFTable> table = doc.getTables(); for (XWPFTable xwpfTable : table) { List<XWPFTableRow> row = xwpfTable.getRows(); for (XWPFTableRow xwpfTableRow : row) { List<XWPFTableCell> cell = xwpfTableRow.getTableCells(); for (XWPFTableCell xwpfTableCell : cell) { if(xwpfTableCell != null){

Apache poi get table from text box

邮差的信 提交于 2019-12-25 10:35:03
问题 I'm using apache poi for iteration table in docx file. All works fine but if table in text box , my code don't see table - table.size() = 0 XWPFDocument doc = new XWPFDocument(new FileInputStream(fileName)); List<XWPFTable> table = doc.getTables(); for (XWPFTable xwpfTable : table) { List<XWPFTableRow> row = xwpfTable.getRows(); for (XWPFTableRow xwpfTableRow : row) { List<XWPFTableCell> cell = xwpfTableRow.getTableCells(); for (XWPFTableCell xwpfTableCell : cell) { if(xwpfTableCell != null){

How can I remove all extraneous spaces from a *.docx file?

妖精的绣舞 提交于 2019-12-25 07:46:26
问题 I want to remove all superfluous spaces from a .docx file. If there are cases where there are more than two, to accomplish this manually I need to do a search-and-replace for two spaces multiple times to get all of them, and it's hard to tell when I'm "finished." 回答1: This code, using the docx library, accomplishes it: private void RemoveSuperfluousSpaces(string filename) { bool superfluousSpacesFound = true; using (DocX document = DocX.Load(filename)) { List<int> multipleSpacesLocs; while

开源Office Word——DocX

点点圈 提交于 2019-12-25 06:48:59
1. 前言 请阅读前请看以下这位大神的文章 http://www.cnblogs.com/asxinyu/archive/2013/02/22/2921861.html 另附两个附件 1、 DocX.DLL 2、 DocX开源文档 (因为原作者非常懒,开发文档才写到 V1.0.0.10 到,这但是我找了好久才找到的,打开可能会无法显示,鼠标右键,好像有个什么危害之类的选项,并非病毒,你懂的) DocX原作者是,忘记叫什么名字了,给个连接吧,支持原著 http://docx.codeplex.com/ 2 、 DocX 主要长处 DocX 组件眼下的最新版本号是 V1.0.0.12 ,主要特点有: 1. 支持在文件里插入、删除和替代文本,支持全部的文本格式,如字体,下划线,高亮等。 2. 支持插入图片、超链接、表格、页眉页脚以及自己定义属性等。 3. 支持类似 JQuery 的链式写法,非常方便编程开发。 4 、不用在server上安装微软的 office 软件,便能够使用 5 、轻量级,读写的速度快,我以前用过 aspose 、 wps 开发,没有做过详细測试分析,可是能够感觉出明显速度快非常多 3 、 DocX 缺点 1 、功能不够完好,可是算是能满足大众需求了 2 、不技能 office2003 ,仅仅支持 office2007 版本号以上打开, 2013 打开有些问题 4

vcvarsall.bat error through pip install python-docx

北慕城南 提交于 2019-12-25 02:28:11
问题 When running pip install python-docx I encounter the error message error: Unable to find vcvarsall.bat . These are basically the two solutions: 1) Install VS2008 2) SET VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools Both I've done and the error persists. Does anyone hold another solution? 回答1: You should be using Visual Studio 2010, as Python 3.3 was built with it, and therefore satisfies all dependencies needed. 1) Install VS10 2) SET VS100COMNTOOLS=C:\Program Files

How to replace text(tag) with HTML in docx using Apache POI?

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:07:55
问题 We are going to have some template docx file, where will be some tags like ${content}. I need to replace this tags with HTML. For this purpose I want to use altChunk element in XWPFDocument. Following answer in How to add an altChunk element to a XWPFDocument using Apache POI, I could place altChunk in the end of docx. How can I replace my tag with it? Or could I use any other libraries, may be docx4j? UPD: Template docx files with tags are created by end users with MS Word and looks like:

Why only some page numbers stored in XML of docx file?

…衆ロ難τιáo~ 提交于 2019-12-25 00:18:26
问题 I have added some page number in footer. It is visible in document properly. But if i unzip docx and check the footer.xml only some random page numbers are there. so how MS-Word is able to display page numbers properly, And where it store all page numbers? 回答1: There's no logic as to which page numbers are stored in a Word Open XML document. Basically, the page numbers you see in the Word Open XML header/footer section are meaningless as they'll be regenerated automatically when the document

C# : Editing/saving/Sending a docx document

谁都会走 提交于 2019-12-25 00:01:24
问题 Been strugling with a lot of problems. Using OpenXML on a ASP.NET Core server, I want to create a new docx document based on a template one. Once this document is fully saved, I want it to be sent to my client so he can download it directly. Here's my code : public IActionResult Post([FromBody] Consultant consultant) { using (Stream templateStream = new MemoryStream(Properties.Resources.templateDossierTech)) using (WordprocessingDocument template = WordprocessingDocument.Open(templateStream,