docx

Saving Word DOCX files as PDF [closed]

不羁的心 提交于 2019-12-12 07:15:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm using openxml to create Word DOCX files. I'd like to save these documents once they are created as PDF files. Is there a way I can do this in openxml? I assume the answer is no. If it is no, is there a recommended library or tool I can use to save / print DOCX files as PDF (programatically, in .NET)? I looked

Loading text from .docx to MySQL using Python-docx

雨燕双飞 提交于 2019-12-12 06:06:33
问题 As of now, I am using Python-docx to convert the text in a .docx file into a single string. f = open(os.path.expanduser("~/documents/myFile.docx")) document = opendocx(f) docString = ''.join(getdocumenttext(document)) I am then parsing the string using simple built-in Python split methods. Once the string is parsed into a list, I am loading that list into a MySQL database. This works great, but my only problem is I want to preserve the special characters. The database supports these special

Searching Docx files in java

主宰稳场 提交于 2019-12-12 05:37:55
问题 I am writing an application for searching the Content of Documents i have already written the code for searching the documents which are editable by notepad. I also wish to do the same for docx files. After some research i have come up with these two things http://www.infoq.com/articles/cracking-office-2007-with-java this method requires me to extract docx file and then search the xml files however this would involve an extra overhead on the extraction part and frankly i dont know how to

Conditional new Break for multi-column docx file, C#

浪子不回头ぞ 提交于 2019-12-12 04:16:10
问题 This is a follow-up question for Creating Word file from ObservableCollection with C#. I have a .docx file with a Body that has 2 columns for its SectionProperties . I have a dictionary of foreign words with their translation. On each line I need [Word] = [Translation] and whenever a new letter starts it should be in its own line, with 2 or 3 line breaks before and after that letter, like this: A A-word = translation A-word = translation B B-word = translation B-word = translation ... I

How set bold for docx run apache poi

谁说我不能喝 提交于 2019-12-12 04:09:28
问题 How set bold for run with run.getCTR().getRPr()? I write this code but it doesn't work at all. run.setBold(true); I had the same problem with font-size but I fixed it with this code: CTHpsMeasure size = CTHpsMeasure.Factory.newInstance(); sizeFa.setVal(new BigInteger((sizePoint * 2) + "")); run.getCTR().getRPr().setSz(size); run.getCTR().getRPr().setSzCs(size); Now I want to set bold with code like above, with getCTR(). what should I do? Thanks. 回答1: If run.getCTR().getRPr().setSzCs(size); is

Python: Is there a way I can add a footnote to word document?

旧街凉风 提交于 2019-12-12 03:18:49
问题 I have tried the following with python-docx: section = self.document.sections[0] footer = section._sectPr.footer footer.text = "I am here" I couldn't find a clear footer/header directions in docx documentations. Is there a work around to cover this gap? 回答1: The work around is: Create a document with python-docx. Change the name to 'init.docx' Comment any adding-new-style code Open 'init.docx' Delete everything Save it. Add footnote/Headers to 'init.docx' Change self.document = Document('')

Read Docx files via python

孤人 提交于 2019-12-12 03:08:00
问题 Does anyone know a python library to read docx files? I have a word document that I am trying to read data from. 回答1: A quick search of PyPI turns up the docx package. 回答2: python-docx can read as well as write. doc = docx.Document('myfile.docx') allText = [] for docpara in doc.paragraphs: allText.append(docpara.text) Now all paragraphs will be in the list allText. Thanks to "How to Automate the Boring Stuff with Python" by Al Sweigart for the pointer. 回答3: import docx def main(): try: doc =

PHP: HTML to DOCX

青春壹個敷衍的年華 提交于 2019-12-12 02:26:12
问题 I am trying to figure out if there is a way to convert HTML to DOCX file using PHP. HTML comes from wysiwyg editor (with inline styles) and I want to be able to create a DOCX file from it. Looks like PHPWord can do just some basic inline styles and other libraries don't support inline styles at all. Is there any way to achieve this? 回答1: You can approach it like this: <?php header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=document_name.doc");

pass values from java variables to microsoft word (doc and docx) variables

左心房为你撑大大i 提交于 2019-12-12 02:19:19
问题 How can i replace a microsoft word document variable value with a value from a java variable ? I have a .doc or .docx file template in which i have defined some variables. When user click on download button from my app the .doc or .docx variables must get the value from java variables. 回答1: I use docx4j for that purpose: String inputfilepath = "binding-simple1.docx"; String outputfilepath = "OUT_VariableReplace.docx"; WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .load(new

Render docx file in a browser

懵懂的女人 提交于 2019-12-12 02:09:06
问题 I'm using docx4j to convert a microsoft word document into a pdf then displaying it in a browser http://www.docx4java.org/trac/docx4j and it works well for a preview. The problem I'm facing is that this conversion loses most of the microsoft word document formatting. Page breaks and fonts don't transfer into the PDF format properly and even though I'm using standard font types docx4j doesn't come with them. In a Linux Tomcat hosted scenario fonts are not found and throw exceptions as it falls