docx

Directly convert a single XML file to DOCX

余生颓废 提交于 2020-07-07 06:38:23
问题 I tried to convert a single XML file into a DOCX file, and I did it by transforming my XML into an XHTML by using XSLT, then open the XHTML on MS Word and save it as DOCX. But my task is to convert any XML Structure (DITA, TEI, DocBook, etc.) to DOCX directly ... are there any other way to do it? I just can't find any sources for this. It's always DOCX to XML and not the other way around. 回答1: Yes, you can use XSLT to transform from any of those XML formats to OOXML. XSLT is ideal for XML to

Directly convert a single XML file to DOCX

99封情书 提交于 2020-07-07 06:34:10
问题 I tried to convert a single XML file into a DOCX file, and I did it by transforming my XML into an XHTML by using XSLT, then open the XHTML on MS Word and save it as DOCX. But my task is to convert any XML Structure (DITA, TEI, DocBook, etc.) to DOCX directly ... are there any other way to do it? I just can't find any sources for this. It's always DOCX to XML and not the other way around. 回答1: Yes, you can use XSLT to transform from any of those XML formats to OOXML. XSLT is ideal for XML to

PhpWord doesn't replace text

一世执手 提交于 2020-07-05 02:43:06
问题 I have a docx file and I need to replace some text. This is done inside codeigniter framework; here is the code: $this->load->library('word'); $template = $this->word->loadTemplate($_SERVER['DOCUMENT_ROOT'].'/doc/assets/doc3.docx'); $template->setValue('replacename', 'new'); $template->save($_SERVER['DOCUMENT_ROOT'].'/doc/assets/helloWorld.docx'); When I open the new file I still get "replacename" instad of "new". "replacename" is formatted with Verdana font, 9pt font size (no underline or

How do I apply both bold and italics in python-docx?

怎甘沉沦 提交于 2020-05-27 09:32:25
问题 I'm working on making a dictionary. I'm using python-docx to put it into MS Word. I can easily make it bold, or italics, but can't seem to figure out how to do both. Here's the basics: import docx word = 'Dictionary' doc = docx.Document() p = doc.add_paragraph() p.add_run(word).bold = True doc.save('test.docx') I have tried p.add_run(word).bold.italic = True, but receive a 'NoneType' error, which I understand. I have also tried p.bold = True and p.italic = True before and after the add_run,

How do I apply both bold and italics in python-docx?

那年仲夏 提交于 2020-05-27 09:32:10
问题 I'm working on making a dictionary. I'm using python-docx to put it into MS Word. I can easily make it bold, or italics, but can't seem to figure out how to do both. Here's the basics: import docx word = 'Dictionary' doc = docx.Document() p = doc.add_paragraph() p.add_run(word).bold = True doc.save('test.docx') I have tried p.add_run(word).bold.italic = True, but receive a 'NoneType' error, which I understand. I have also tried p.bold = True and p.italic = True before and after the add_run,

How do I apply both bold and italics in python-docx?

依然范特西╮ 提交于 2020-05-27 09:32:08
问题 I'm working on making a dictionary. I'm using python-docx to put it into MS Word. I can easily make it bold, or italics, but can't seem to figure out how to do both. Here's the basics: import docx word = 'Dictionary' doc = docx.Document() p = doc.add_paragraph() p.add_run(word).bold = True doc.save('test.docx') I have tried p.add_run(word).bold.italic = True, but receive a 'NoneType' error, which I understand. I have also tried p.bold = True and p.italic = True before and after the add_run,

SUM(ABOVE) functionality in apache poi or docx4j

こ雲淡風輕ζ 提交于 2020-05-17 06:05:49
问题 I am trying to implement =SUM(ABOVE) function in docx which is used to sum all elements above to tht column. I was able to implement this with apache poi using : CTSimpleField sumAbove = paragraphInCell.getCTP().addNewFldSimple(); sumAbove.setInstr("=SUM(ABOVE)"); //set sum field dirty, so it must be calculated while opening the document sumAbove.setDirty(STOnOff.TRUE); This is ok when someone opens the document and it calculates it. But if I need to convert the document without opening it to

SUM(ABOVE) functionality in apache poi or docx4j

一曲冷凌霜 提交于 2020-05-17 06:04:24
问题 I am trying to implement =SUM(ABOVE) function in docx which is used to sum all elements above to tht column. I was able to implement this with apache poi using : CTSimpleField sumAbove = paragraphInCell.getCTP().addNewFldSimple(); sumAbove.setInstr("=SUM(ABOVE)"); //set sum field dirty, so it must be calculated while opening the document sumAbove.setDirty(STOnOff.TRUE); This is ok when someone opens the document and it calculates it. But if I need to convert the document without opening it to

XWPFDocument returning 1 number of pages for docx file

↘锁芯ラ 提交于 2020-05-15 09:28:04
问题 I am using XWPFDocument library to find number of pages in docx file. Below is my code snippet : XWPFDocument docx = null; try { docx = new XWPFDocument(POIXMLDocument.openPackage(filePath)); totalPages = docx.getProperties().getExtendedProperties().getUnderlyingProperties().getPages(); } catch (IOException e) { logger.error("Error while loading word document at file location {}", filePath); totalPages = 0; } For some .docx it is working fine but for some files it is returning 1 inspite of

office(Word、Excel、PPT等图标异常和桌面无新建解决方案)

↘锁芯ラ 提交于 2020-05-08 06:36:33
前言吐槽: 前不久因为安装了WPS,然后觉得不好用卸载WPS装回office就出现了一个很恶心的问题:word文档、excel文档、PPT这些办公软件图标异常,显示的是下面这样: 打开倒是可以正常用word打开,文件关联是对的 重装office都没解决,还用到了office官方的疑难杂症卸载修复程序,也没有解决 最后是WPS工具---高级设置把那些关联的都勾选掉,在卸载WPS修改注册表才能解决 下载地址: 修复office应用程序疑难杂症 进入正题 桌面新建没有office相关文档选项 这是我已经调了注册表成功后的,没有调之前这里是没有图标没有新建word,PPT,excel新建选项的 CTRL + F 快捷键,查找“docx”的位置,当然这里也可以自己下拉查找。 word修改.docx注册表的[HKEY_CLASSES_ROOT\.docx] 按照同样的方法,我们进入注册表寻找“xlsx”的位置,并将(默认)改为Excel.Sheet.12 然后寻找“pptx”,将(默认)改为PowerPoint.Show.12 然后就能成功了~ office相关图标显示异常解决方案 注册表的[HKEY_CLASSES_ROOT\Word.Document.12]这一项默认哪里是编写新建时候的名称 注册表的[HKEY_CLASSES_ROOT\Word.Document.12