docx

Docx to pdf using openoffice headless way too slow

你说的曾经没有我的故事 提交于 2019-12-05 05:38:40
I've been using PHPWord for docx files generation. And it's been working great. But now I have the need to also make available some of those files on a pdf version. After a few research I found PyODConverter which use OOo. Seemed quite a good option since I don't want to depend on third party web services. I tried it out on my machine and it works fined, so I've applied it on my server as well. It took a little longer but I've managed to get it working on there too. There is however an (bad) issue. On the server this takes about 21 seconds to get it done, while on my machine it doesn't take

Why does my custom XML not carry over to a new version of a DOCX file when Word saves it?

社会主义新天地 提交于 2019-12-05 04:33:48
I'm adding in some custom XML to a docx for tracking it inside an application I'm writing. I've manually done it via opening the Word Document via a ZIP library, and via the official Open XML SDK route. Both have the same outcome of my XML being inserted into customXml folder in the document. The document opens fine in Word for both of these methods, and the XML is present. BUT when I then save the document as MyDoc2.docx for example all my XML disappears. What am I doing wrong? Microsoft links I've been following: http://msdn.microsoft.com/en-us/library/bb608597.aspx http://msdn.microsoft.com

Open xml replace text from word file and return memory stream using MVC

◇◆丶佛笑我妖孽 提交于 2019-12-05 04:17:15
问题 I have an word file that contain my specified pattern text {pattern} and I want to replace those pattern with new my string which was read from database. So I used open xml read stream from my docx template file the replace my pattern string then returned to stream which support to download file without create a temporary file. But when I opened it generated me error on docx file. Below is my example code public ActionResult SearchAndReplace(string FilePath) { MemoryStream mem = new

将.docx文件转化为.pdf文件

六眼飞鱼酱① 提交于 2019-12-05 03:56:10
将.docx文件转化为.pdf文件 在需要转化.docx为.pdf的文件夹中打开powershell然后运行该程序,可以将文件夹下所有.docx文件转化为.pdf文件。 from win32com.client import Dispatch, constants, gencache import os def doc2pdf(docPath, pdfPath): docPathTrue = os.path.abspath(docPath) pdfPathTrue = os.path.abspath(pdfPath) #word = gencache.EnsureDispatch('Word.Application') word = Dispatch('Word.Application') doc = word.Documents.Open(docPathTrue, ReadOnly=1) doc.ExportAsFixedFormat(pdfPathTrue, constants.wdExportFormatPDF, Item=constants.wdExportDocumentWithMarkup, CreateBookmarks=constants.wdExportCreateHeadingBookmarks) word.Quit(constants

Jinja2 for word templating

你。 提交于 2019-12-05 02:37:06
问题 I would like to use jinja2 for word templating like mentioned is this short article. The problem I'm facing is as follows, if I put {{title}} in my word-file the resulting xml can look like this: <w:r><w:t>{{</w:t></w:r><w:proofErr w:type="gramStart"/><w:r><w:t>title</w:t></w:r><w:proofErr w:type="gramEnd"/><w:r><w:t>}}</w:t></w:r></w:p> so it is impossible for jinja to replace this accordingly. Is there a possibility to prevent word from splitting {{title}} in separate text elements? (if I

RStudio, knitr, pandoc, Word: how do I get a 'new page' in my docx?

拟墨画扇 提交于 2019-12-05 01:45:14
I am using the RStudio, knitr, pandoc, MS Word combo to get my final results in a docx document. Occasionally, I would like the report to continue on a new page. I can't find the way to achieve this. From what I have Googled, it seems to be possible with CSS . I don't know HTML or CSS , but if it is the solution I will learn. Just don't want to take the wrong road... Try the LaTeX command \newpage. Pandoc recognizes it and might (not on a computer right now) translate it to a Word page break. ​```{=openxml} <w:p> </w:pPr> <w:r> <w:br w:type="page"/> </w:r> </w:p> ​``` Insert this codes in the

how can I read write edit pptx/docx/xlsx files using PHP?

牧云@^-^@ 提交于 2019-12-05 01:28:46
问题 Is there a library extension available for efficiently handling pptx/docx/xlsx files using PHP? As of now I am more interested in PPTX files. Thanks 回答1: As per what i know, those file formats docx,xlsx,pptx are just zip files. they belong to Office Open XML (OOXML) standard. In PHP we have this library for manipulating this type of zip documents: http://php.net/manual/en/book.zip.php You can find all documentation about this ooxml standard here: http://www.ecma-international.org/publications

How can I query a Word docx in an ASP.NET app?

时间秒杀一切 提交于 2019-12-04 23:45:22
问题 I would like to upload a Word 2007 or greater docx file to my web server and convert the table of contents to a simple xml structure. Doing this on the desktop with traditional VBA seems like it would have been easy. Looking at the WordprocessingML XML data used to create the docx file is confusing. Is there a way (without COM) to navigate the document in more of an object-oriented fashion? 回答1: I highly recommend looking into the Open XML SDK 2.0. It's a CTP, but I've found it extremely

Java - POI - Add a picture to the header

只愿长相守 提交于 2019-12-04 22:33:21
I have been trying to add a picture to a new docx file using Java POI to the header. 1) I have added a header, and added a text to it (using XWPFHeaderFooterPolicy). 2) I have create an image (using CustomXWPFDocument). 3) But I could not insert the image inside the header area. I have tried to do so through adding the picture into the same paragraph of the header, but it did not work. Here is the function that should add the picture to the header. It takes a CustomXWPFDocument object that has been already created: private void addLogo(CustomXWPFDocument doc) throws InvalidFormatException,

Converting docx to pdf using openxml and pdfcreator in c#

眉间皱痕 提交于 2019-12-04 20:09:34
I need to convert docx to pdf file in server. I have seen PDFCreator will do, based on below link( http://sourceforge.net/projects/pdfcreator/ ). I need some suggestions on this as listed below: can i use PDF Creator in server side. without creating word object, can i convert docx to pdf with openxml by using pdfcreator API. Please give me reply soon. You can use docx4j.NET to convert a docx to XSL FO, and from there, to PDF. Or, indeed, to any of the other output formats supported by Apache FOP. See this sample . docx4j.NET is an IKVM'd DLL of docx4j, an ASL v2 licensed open source project.