docx

Converting multiple pages of a Docx into multiple PNG files

我只是一个虾纸丫 提交于 2020-01-25 07:37:11
问题 I am trying to convert a .docx document into a .png file using Docx4j in java , and achieved the conversion using the piece of code below. The generated image is for the first page only, while I want to have multiple png files , one for each page of the docx document. I could not find any way to put this thing in a loop or extract the document pagewise. WordprocessingMLPackage wordMLPckg = Docx4J.load(theFile); OutputStream os = new FileOutputStream(outFile); FOSettings settings = Docx4J

How can I add a Python site-package folder (that's not being included) to a PyInstaller spec file?

。_饼干妹妹 提交于 2020-01-25 06:15:29
问题 I am having trouble including a python package while using PyInstaller, particularly docxcompose . This is a package that needs to import its site-package folder within the PyInstaller directory. I have pip installed docxcompose and it is in my site-packages library, with the folder labeled as docxcompose . import docxcompose is explicitly listed in the python file I am referencing in PyInstaller. I am debugging using a spec file and the --onedir method, as I want to eventually install using

python___docx模块

有些话、适合烂在心里 提交于 2020-01-22 23:58:02
一,docx模块 Python可以利用python-docx模块处理word文档,处理方式是面向对象的。也就是说python-docx模块会把word文档,文档中的段落、文本、字体等都看做对象,对对象进行处理就是对word文档的内容处理。 二,相关概念 如果需要读取word文档中的文字(一般来说,程序也只需要认识word文档中的文字信息),需要先了解python-docx模块的几个概念。 1,Document对象,表示一个word文档。 2,Paragraph对象,表示word文档中的一个段落 3,Paragraph对象的text属性,表示段落中的文本内容。 三,模块的安装和导入 需要注意,python-docx模块安装需要在cmd命令行中输入pip install python-docx,如下图表示安装成功(最后那句英文Successfully installed,成功地安装完成) 注意在导入模块时,用的是import docx。 也真是奇了怪了,怎么安装和导入模块时,很多都不用一个名字,看来是很有必要出一个python版本的模块管理程序python-maven了,本段纯属PS。 四,读取word文本 在了解了上面的信息之后,就很简单了,下面先创建一个D:\temp\word.docx文件,并在其中输入如下内容。 #-*- conding:utf-8 -*- '''

Opening Word (.docx) files on a Windows Form C#

老子叫甜甜 提交于 2020-01-20 04:23:13
问题 I'm trying to make my program have the ability to display a Microsoft Word file on a form but not having any luck in doing so. I want to be able to open the file and display it on the form as a Read-Only. So basically just display it's contents. Various users on the web have recommended displaying files in the WebBrowser control (under toolbox). I have tried this but failed to get it working. My end goal is to be able to annotate on top of the web browser (or something of similar manner) and

doc文档转化为docx,python

限于喜欢 提交于 2020-01-17 11:49:02
doc文件转化为docx 目前找到doc文件转化为docx比较少,商业版 com.spire.doc 很好用,但是需要收费 查找资料,找到一种利用python脚本,将doc转化docx的实现方式,性能好像很差 Java代码 package com.pdf.pdfdemo; import java.io.BufferedReader; import java.io.InputStreamReader; public class Python { public static void main(String[] args) throws Exception { python2(); } public static void python1() throws Exception{ // define the command string String commandStr = new String( "python E:\\python\\TestMain.py "); //Create a Process instance and execute commands Process pr = Runtime.getRuntime().exec(commandStr); //Get the result produced by executing the above commands

使用python操作word

那年仲夏 提交于 2020-01-17 01:50:52
有两种方式: 使用win32com 使用docx 1.使用win32com扩展包 只对windows平台有效 代码: # coding=utf-8 import win32com from win32com.client import Dispatch, DispatchEx word = Dispatch('Word.Application') # 打开word应用程序 # word = DispatchEx('Word.Application') #启动独立的进程 word.Visible = 0 # 后台运行,不显示 word.DisplayAlerts = 0 # 不警告 path = 'G:/WorkSpace/Python/tmp/test.docx' # word文件路径 doc = word.Documents.Open(FileName=path, Encoding='gbk') # content = doc.Range(doc.Content.Start, doc.Content.End) # content = doc.Range() print '----------------' print '段落数: ', doc.Paragraphs.count # 利用下标遍历段落 for i in range(len(doc.Paragraphs)): para

Adding image with docx4j to doc file

蓝咒 提交于 2020-01-16 19:25:33
问题 I'm trying to add an image to a docx file using docx4j library within Android. I've faced to an exception: E/AndroidRuntime(21818): java.lang.ExceptionInInitializerError E/AndroidRuntime(21818): at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:134) E/AndroidRuntime(21818): at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:280) E/AndroidRuntime(21818): at org

How can I make my bullets larger in Open XML?

大城市里の小女人 提交于 2020-01-16 07:50:17
问题 I'm generating docx files using the Open XML SDK for .NET The bullets in my lists are super tiny but I can't figure out why. So here's what I've done: Generating a doc with a single bulleted item Created a doc from Word with a single bulleted item Used Open XML Productivity Tools to compare both files Cannot for the life of me see any differences If I click on the bullet in both, to where it shows the font and size, they are both the same! I don't see any differences in the numbering section

docx4j cannot render <text-indent>

余生长醉 提交于 2020-01-15 11:17:30
问题 I am using docx4j-ImportXHTML to convert an XHTML into a docx. When rendering to docx I notice it doesn't render CSS text-indent property. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of document</title> </head> <body> <p style="text-indent:100px;">indent text</p> </body> </html> When running above code I do not see any indentation of the first line of

Libraries to generate docx files (Open XML)

放肆的年华 提交于 2020-01-14 08:57:31
问题 We need to generate docx documents from an asp.net mvc site. The documents will vary a great deal, but they are pretty basic - the only thing out of the ordinary is the need to include tables. The c# code that generates the documents will need to create similar html/css as well. We don't have time to buy a commercial product for this. Should we just read the spec and write some code to spit out the XML, or are there libraries available that would do the trick? Edit: looks like Microsoft's