.doc

how create a Word document from a template or existing document with Java?

不羁的心 提交于 2019-12-06 02:00:04
I have a document template where some fields are static and others are dynamic. I need to replace some data (name, last name, salary) and generate the new file. What library do you recommend to do this? Is POI appropriate? I am working with Spring, Java EE6 and Oracle. max You can give Apache POI a try but the HWPF and XWPF part of POI which are required to manipulate word files are really complicated to use - you need to have at least a good understanding how a word file is structured! Solution using iText and PDF I did something similar with PDF (this might be an option for you) 1) You can

Updating a .docx file's page header using Apache POI

狂风中的少年 提交于 2019-12-06 00:33:38
How can I update the page header of a .docx file using the Apache POI 3.7 API? First up, call getHeaderFooterPolicy() on your XWPFDocument, which returns a HeaderFooterPolicy . From that, you can identify the appropriate header for your page (eg Default, First Page etc) Once you have the appropriate XWPFHeader that you want to change, then you can go about editing it as any other document part. You can fetch the tables, the paragraphs etc, then remove them, add new ones, change the text of them etc. It's all the same process then as editing the main document. Since your document is in .docx

PHP - Get a word count from an uploaded Microsoft Word document

最后都变了- 提交于 2019-12-05 06:40:32
问题 I am trying to grab a word count from an uploaded word doc (.doc, .docx, .rtf) but it always carries through the annoying Word formatting. Anybody tackled this issue before and know how to solve it? Thanks :) 回答1: You will need to: Distinguish the file type $file_name = $_FILES['image']['name']; $file_extn = end(explode(".", strtolower($_FILES['image']['name']))); if($file_extn == "doc" || $file_extn == "docx"){ docx2text(); }elseif($file_extn == "rtf"){ rtf2text(); } Convert the document to

Storing math equations from .doc MS Word file & restoring them

北城余情 提交于 2019-12-04 17:14:20
I'm processing Microsoft Word files which contain math equations and images. I need to get these InlineShapes objects and store them as is & then restore them when needed. I know how to get InlineShape objects from file, the problem is how can I store them. Saving them as images is not an option! MethodMan using System; using System.Drawing; using System.IO; using System.Threading; using Page = System.Web.UI.Page; using Microsoft.Office.Interop.Word; using Microsoft.VisualBasic.Devices; public partial class ReadIMG : System.Web.UI.Page { private Application m_word; private int m_i; protected

Reading .doc file without launching MSWord

て烟熏妆下的殇ゞ 提交于 2019-12-04 03:47:00
问题 I'm trying to open .doc file and read its content. But i can't find any way how to do this without launching MSWord. Now I have following code: Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application(); object nullObject = System.Reflection.Missing.Value; object file = @"C:\doc.doc"; Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(ref file, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref

Quickly Convert (.rtf|.doc) Files to Markdown Syntax with PHP

試著忘記壹切 提交于 2019-12-03 00:06:50
问题 I've been manually converting articles into Markdown syntax for a few days now, and it's getting rather tedious. Some of these are 3 or 4 pages, italics and other emphasized text throughout. Is there a faster way to convert (.rtf|.doc) files to clean Markdown Syntax that I can take advantage of? 回答1: If you happen to be on a mac, textutil does a good job of converting doc, docx, and rtf to html, and pandoc does a good job of converting the resulting html to markdown: $ textutil -convert html

Quickly Convert (.rtf|.doc) Files to Markdown Syntax with PHP

北城余情 提交于 2019-12-02 13:53:22
I've been manually converting articles into Markdown syntax for a few days now, and it's getting rather tedious. Some of these are 3 or 4 pages, italics and other emphasized text throughout. Is there a faster way to convert (.rtf|.doc) files to clean Markdown Syntax that I can take advantage of? David If you happen to be on a mac, textutil does a good job of converting doc, docx, and rtf to html, and pandoc does a good job of converting the resulting html to markdown: $ textutil -convert html file.doc -stdout | pandoc -f html -t markdown -o file.md I have a script that I threw together a while

Reading .doc file without launching MSWord

梦想与她 提交于 2019-12-01 19:46:30
I'm trying to open .doc file and read its content. But i can't find any way how to do this without launching MSWord. Now I have following code: Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application(); object nullObject = System.Reflection.Missing.Value; object file = @"C:\doc.doc"; Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(ref file, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref nullObject, ref

multiple .doc to .docx file conversion using python

丶灬走出姿态 提交于 2019-12-01 08:42:59
I want to convert all the .doc files from a particular folder to .docx file. I tried using the following code, import subprocess import os for filename in os.listdir(os.getcwd()): if filename.endswith('.doc'): print filename subprocess.call(['soffice', '--headless', '--convert-to', 'docx', filename]) But it gives me an error: OSError: [Errno 2] No such file or directory I prefer to use the glob module for tasks like that. Put this in a file doc2docx.py . To make it executable, set chmod +x . And optionally put that file in your $PATH as well, to make it available "everywhere". #!/usr/bin/env

how to read .doc, .docx, .xls files in android [duplicate]

[亡魂溺海] 提交于 2019-11-29 10:03:34
This question already has an answer here: Convert Word doc to HTML programmatically in Java 11 answers I am trying to show the PDF & .DOC files in android. I am able to show PDF files, but I have problem to show the .DOC, .DOCX, .PPT and .xls files . With the help of WORD-EXTRACTOR we can fetch the text of the doc file but the problem is it only gives text not images from .doc file. I searched to convert the doc file to PDF file but didn't succeed. Is it possible to convert the .doc files to PDF on device ? If we want to show the .doc or .docx document in the android devices so which library