docx

How can I search a word in a Word 2007 .docx file?

心已入冬 提交于 2019-11-26 15:50:55
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase". More exactly, a .docx document is a Zip archive in OpenXML format: you have first to uncompress it. I downloaded a sample (Google: some search term filetype:docx ) and after unzipping I found some folders. The word folder contains the document itself, in file document.xml . After reading your

PageOffice与Apache POI的区别

亡梦爱人 提交于 2019-11-26 15:10:53
1. 相同之处: 都可以对MS Office文档进行填充数据,转HTML、PDF等。 服务器端都不需要装MS Office办公软件。 都支持windows、linux、unix服务器。 2. 不同之处: PageOffice是客户端生成文档的, POI是服务器端生成文档的。使用PageOffice需要在客户端电脑上安装PageOffice的客户端posetup。exe程序,而POI不需要安装任何程序。 PageOffice对于doc和docx的文档的处理方式相同,客户不需要知道其内部的处理方式,对用户提供的调用方法都是相同的,例如:对doc和docx的文档填充数据,对外提供的是统一的方法setValue("值")。而POI对于doc,docx的文档的处理方式是不同的,在调用之前用户必须判断是什么格式的文档,就用其对应的基类,例如:处理doc格式的文档的基类是Hwpf,处理docx格式的文档的基类是Xwpf,两者在填充数据时提供内部方法繁琐,接口混乱,使用非常不方便。 在转PDF的功能中POI没有提供最直接的转PDF的方法,所以我们必须借助其它第三方的工具转html,例如可以使用itext,OpenOffice等第三方工具来结合POI对Office文档转PDF功能,但是itext对于docx的文档支持比较好,但对于doc的文档,没有提供比较完善的接口

java利用Freemarker模板生成docx格式的word文档

 ̄綄美尐妖づ 提交于 2019-11-26 15:10:42
之前写过一篇利用Freemarker模板生成doc的博客,不过那个博客有点缺陷,生成的word占用的空间很大,几百页的word有将近100M了。所以,后面需求必须是生成的docx文档,结果导出后正常才几M,昨天花了一天的时间实现。 具体思路 1.把docx文档修改为ZIP格式(修改.docx后缀名为.zip) 2.获取zip里的document.xml文档以及_rels文件夹下的document.xml.rels文档 3.把内容填充到document.xml里,以及图片配置信息填充至document.xml.rels文档里 4.在输入docx文档的时候把填充过内容的的 document.xml、document.xml.rels用流的方式写入zip(详见下面代码)。 5.把图片写入zip文件下word/media文件夹中 6.输出docx文档 docx模板修改成zip格式后的信息如下(因为word文档本身就是ZIP格式实现的) document.xml里存放主要数据 media存放图片信息 _rels里存放配置信息 注意:如果docx模板里的图片带有具体路径的话,则图片的格式不受限制。 如果docx模板里里图片信息不带路径,则模板仅支持和模板图片类型一致的图片。 处理流程 1.准备好docx模板 2.把docx文档修改为ZIP格式(修改.docx后缀名为.zip) 3

PageOfficeV4.0 FileMaker组件功能简介

故事扮演 提交于 2019-11-26 14:25:24
应用场景 在一些特殊应用场合,客户希望在服务器上生成文档的同时并填充数据,客户端的页面不显示打开文档。 目前服务器上生成文档第一种就是方案是采用Jacob, 但是局限于windows平台,往往许多Java程序运行于Linux等其他操作系统,在此不讨论该方案。 第二是POI,但是服务器上生成文档对服务器压力很大,而且它的Excel处理勉强可以, Word模块还局限于读取Word的文本内容,写Word文件的功能就更弱;另一个致命的问题是,处理doc格式和处理docx格式的类几乎完全不同,要分开针对不同的格式写不同的代码,这就意味着用户上传的docx格式文件如果使用了doc的扩展名,程序马上崩溃。而且POI结构混,编码比较复杂,开发过程非常消耗时间和精力。 所以针对这一系列的问题,PageOffice开发出来了FileMakerCtrl组件,该组件完全符合PageOffice的架构设计,FileMakerCtrl在客户端生成Office或PDF文档并上传到服务器,但是并不在Web网页里显示Office文档。 FileMakerCtrl对象使用说明 FileMakerCtrl 类是PageOffice开发平台中的核心类。和PageOfficeCtrl控件不同,FileMakerCtrl在Web网页里不显示Office文档,而是直接在线生成Office文档或将Office文档转换成PDF文档

Inserting Image into DocX using OpenXML and setting the size

风格不统一 提交于 2019-11-26 13:08:40
问题 I am using OpenXML to insert an image into my document. The code provided by Microsoft works, but makes the image much smaller: public static void InsertAPicture(string document, string fileName) { using (WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(document, true)) { MainDocumentPart mainPart = wordprocessingDocument.MainDocumentPart; ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Jpeg); using (FileStream stream = new FileStream(fileName, FileMode

开源Word读写组件DocX介绍与入门

亡梦爱人 提交于 2019-11-26 11:58:17
今天向大家介绍一款.NET下的开源轻量级Word 2007/2010格式读写组件DocX,很小巧,能够满足大部分工作需求吧,最重要的是可以不用庞大的Office。 1.前言 读写Offic格式的文档,大家多少都有用到,可能方法也很多,组件有很多。这里不去讨论其他方法的优劣,只是向大家介绍一款开源的读写word文档的组件。读写Excel有NPOI,读写Word,那看看 DocX 吧。 DocX 是一个以非常直观简单的方式操作 Word 2007/2010文件的轻量级.NET组件。它的速度非常快,而且不需要安装微软的Office软件。在中国,免费并且小巧的WPS有足够的 理由让很多用户放弃庞大的Office,那在实际软件开发过程中,这玩意就有用处了。遗憾是不支持2003,但总归是被淘汰的趋势,而且用WPS,也没有 啥版本的区别。 2.DocX的主要特点 DocX组件目前的最新版本是V1.0.0.12,主要特点有: 1.支持在文件中插入、删除和替代文本,支持所有的文本格式,如字体,下划线,高亮等。 2.支持插入图片、超链接、表格、页眉页脚以及自定义属性等。 3.支持类似JQuery的链式写法,很方便编程开发。 3.DocX入门例子 DocX 中一个Word文档的主要对象有段落 (Paragraph)、图像(Image)、表格(Table)、自定义属性(CustomProperty)

How can i read .docx file? [closed]

血红的双手。 提交于 2019-11-26 09:50:22
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I have a .docx file and it contains many email addresses to which i want to bulk mail. How can i read docx file through c#? 回答1: The easiest way is probably to use the Open XML SDK 2.0 Get Code Snippets for Visual Studio 2008 for some examples And I would highly recommend

Extract text from doc and docx

我只是一个虾纸丫 提交于 2019-11-26 08:11:25
问题 I would like to know how can I read the contents of a doc or docx. I\'m using a Linux VPS and PHP, but if there is a simpler solution using other language, please let me know, as long as it works under a linux webserver. 回答1: This is a .DOCX solution only. For .DOC or .PDF you'll need to use something else like pdf2text.php for PDF function docx2text($filename) { return readZippedXML($filename, "word/document.xml"); } function readZippedXML($archiveFile, $dataFile) { // Create new ZIP archive

C# /VB.NET 操作Word (一)——插入、修改、删除Word批注

淺唱寂寞╮ 提交于 2019-11-26 03:53:06
批注内容可以是对某段文字或内容的注释,也可以是对文段中心思想的概括提要,或者是对文章内容的评判、疑问,以及在阅读时给自己或他人起到提示作用。本篇文章中将介绍如何在C#/VB中操作Word批注,主要包含以下要点: 插入Word批注 修改Word批注 删除Word批注 使用工具: Free Spire.Doc for .NET 6.3 (最新社区版) 注 :编辑代码前注意添加引用Sprie.Doc.dll(dll文件可在安装路径下的Bin文件夹中获取) 1.插入Word批注 C# using Spire.Doc; using Spire.Doc.Documents; using Spire.Doc.Fields; namespace InsertComment_Word { class Program { static void Main(string[] args) { //实例化一个Document类对象,并加载Word文档 Document document = new Document(); document.LoadFromFile("sample.docx"); //获取第一段第一节 Section section = document.Sections[0]; Paragraph paragraph = section.Paragraphs[0]; //添加文本到批注

Is there a Java API that can create rich Word documents? [closed]

安稳与你 提交于 2019-11-26 00:50:39
问题 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 have a new app I\'ll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What\'s a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some hidden gotcha\'s in using them? Some clarifications: I can\'t