docx

Generating word documents with PHP [duplicate]

时间秒杀一切 提交于 2019-11-28 18:24:12
This question already has an answer here: Create Word Document using PHP in Linux [closed] 10 answers Do you know any way to generate doc and docx files with PHP and without COM component? I've tried PHPWord , which creates docx files, but these cannot be opened in OpenOffice because they cause it to crash. I've also tried PHPDocx , but it didn't generate any files at all. See here: http://www.webcheatsheet.com/php/create_word_excel_csv_files_with_php.php To quote from the article the most common method: Using HTTP Headers In this method you need to format the HTML/PHP page using Word-friendly

Convert XML to JSON format

徘徊边缘 提交于 2019-11-28 18:22:03
I have to convert docx file format (which is in openXML format) into JSON format. I need some guidelines to do it. Thanks in advance. Tommy Siu You may take a look at the Json-lib Java library, that provides XML-to-JSON conversion. String xml = "<hello><test>1.2</test><test2>123</test2></hello>"; XMLSerializer xmlSerializer = new XMLSerializer(); JSON json = xmlSerializer.read( xml ); If you need the root tag too, simply add an outer dummy tag: String xml = "<hello><test>1.2</test><test2>123</test2></hello>"; XMLSerializer xmlSerializer = new XMLSerializer(); JSON json = xmlSerializer.read("<x

How to zip a WordprocessingML folder into readable docx

末鹿安然 提交于 2019-11-28 16:51:24
I have been trying to write a simple Markdown -> docx parser/writer, but am completely stuck with the last part, which should be the easiest: i.e. compressing the folder into a .docx that Word, or any other .docx reader, will recognize. My parser-writer is irrelevant really: I have this problem if I simply unzip any old Word-produced *.docx and then try to recompress it with the usual compression utilities, giving it the file-ending docx. Is there some mysterious header I should be adding, or do I need a special OPC compression utility, or what? I don't so much want a tool that will do this,

前端实现在线预览pdf、docx、xls、ppt等文件

有些话、适合烂在心里 提交于 2019-11-28 14:05:54
总结:预览.pdf文件可以直接在浏览器中打开 1.预览doxc文档: https://view.officeapps.live.com/op/view.aspx?src=http://mczaiyun.top/ht/3.docx //内网不可用,可惜了 <a href="http://www.xdocin.com/xdoc?_func=to&_format=html&_cache=1&_xdoc=http://www.xdocin.com/demo/demo.docx" target="_blank" rel="nofollow">XDOC</a>//方法一致,内网不可用,可惜了 借助微软提供的方法,但是内网是不可用的,所有这个方法passed掉~~ 2.预览pdf文档: 2.1 可以直接a标签重开一个页面进行预览 <a href="http://storage.xuetangx.com/public_assets/xuetangx/PDF/PlayerAPI_v1.0.6.pdf" target="_blank">PPT在线预览</a> 适用场景: 首次进来的时候只显示文件名称,当点击预览的时候,才会重新打开一个窗口进行预览 2.2 代码地址:下载运行可以使用: https://github.com/zhongqiulan/ppt //内网可以使用,非常好 关键知识点

Using OpenXML SDK to replace text on a docx file with a line break (newline)

一个人想着一个人 提交于 2019-11-28 12:44:41
I am trying to use C# to replace a specific string of text on an entire DOCX file with a line break (newline). The string of text that I am searching for could be in a paragraph or in a table in the file. I am currently using the code below to replace text. using (WordprocessingDocument doc = WordprocessingDocument.Open("yourdoc.docx", true)) { var body = doc.MainDocumentPart.Document.Body; foreach (var text in body.Descendants<Text>()) { if (text.Text.Contains("##Text1##")) { text.Text = text.Text.Replace("##Text1##", Environment.NewLine); } } } ISSUE: When I run this code, the output DOCX

python用python-docx读写word文档

删除回忆录丶 提交于 2019-11-28 12:41:21
python-docx库可用于创建和编辑Microsoft Word(.docx)文件。 官方文档: https://python-docx.readthedocs.io/en/latest/index.html 备注: doc是微软的专有的文件格式,docx是Microsoft Office2007之后版本使用,其基于Office Open XML标准的压缩文件格式,比 doc文件所占用空间更小。docx格式的文件本质上是一个ZIP文件,所以其实也可以把.docx文件直接改成.zip,解压后,里面的 word/document.xml包含了Word文档的大部分内容,图片文件则保存在word/media里面。 python-docx不支持.doc文件,间接解决方法是在代码里面先把.doc转为.docx。 一、安装包 pip3 install python-docx 二、创建word文档 下面是在官文示例基础上对个别地方稍微修改,并加上函数的使用说明 from docx import Document from docx.shared import Inches document = Document() #添加标题,并设置级别,范围:0 至 9,默认为1 document.add_heading('Document Title', 0) #添加段落,文本可以包含制表符(\t)

get docx file contents using javascript/jquery

淺唱寂寞╮ 提交于 2019-11-28 11:42:36
wish to open / read docx file using client side technologies (HTML/JS). kindly assist if this is possible . have found a Javascript library named docx.js but personally cannot seem to locate any documentation for it. ( http://blog.innovatejs.com/?p=184 ) the goal is to make a browser based search tool for docx files and txt files . any help appreciated. edi9999 With docxtemplater , you can easily get the full text of a word (works with docx only) by using the doc.getFullText() method. HTML code: <script src="build/docxgen.js"></script> <script src="vendor/FileSaver.min.js"></script> <script

Reading doc and docx files using C# without having MS Office installed on server

懵懂的女人 提交于 2019-11-28 11:22:30
I'm working on a project (asp.net, c#, vb 2010, .net 4) and I need to read both DOC and DOCX files, that I've previosly uploaded (I've done uploading part). Tricky part is that I don't have MS Office installed on server and that I can't use it. Is there any public library that I can include into my project without having to install anything? Both docs are very simple: NUMBER TAB STRING NUMBER TAB STRING NUMBER TAB STRING ... I need to extract number and string for each row (paragraph). May someone help with this? I should repeat once again that I'm limited in a way that I can't install

Apache POI XWPF adding shapes to header

*爱你&永不变心* 提交于 2019-11-28 10:57:26
问题 I'm trying to add some shapes and a logo-file into the header of my word docx document. Adding a picture works for me, but i didn't find any solution how to add a shape. can anyone help me? String imgFile="logo.png"; XWPFDocument document = new XWPFDocument(new FileInputStream("myfile.docx")); CTSectPr sectPr = document.getDocument().getBody().addNewSectPr(); XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr); XWPFHeader header = headerFooterPolicy

How to create and save a .rtf, .doc, .docx in Objective-C for iOS

可紊 提交于 2019-11-28 10:29:57
I am looking to create and save either a rtf, doc or docx file on an iPad (iOS). The scenario is that we'd like to assist a user in creating content on their iPad and then let them email this as an editable document cross-platform (OS X, WIN). I am open to other solutions besides the rtf, doc or docx file format. Thanks, James RTF is going to be the easiest, because it's a plain text format. It's kind of like HTML, but without closing tags. Here is a class for writing an RTF, but it requires a lot of dependencies from elsewhere in the framework. DOCX would be rather difficult. It's actually a