docx

Apply a TableStyle to a Word Table

拟墨画扇 提交于 2019-12-12 01:48:28
问题 Trying to style a table using a predefined style but nothing is working. I've tried with a a newly created document and one created from a saved template. Using the SDK Productivity tool I can see the style is there in the template but it's not being applied. I've tried appended the style or setting it directly and neither seem to work. public static void CreateWordprocessingDocument(string fileName) { string[,] data = { {"Texas", "TX"}, {"California", "CA"}, {"New York", "NY"}, {

Why can't I add an xml node to the Header and Footer sections in Word Document 2007?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 00:39:54
问题 I am facing strange problem in Word Document-2007. I have created a Word Document Template and I create XML nodes for that template to print repeating data, for that I keep all the XML nodes on Word Document using Developer Tab it is working fine. Because that template creates more than 6 pages, my client needs to show the the header and footer section. I put the XML node on Header part section, but it won't print that node value. If I put static text on Header section it should show

OpenTBS: How to dynamically change color of rows in a table

北慕城南 提交于 2019-12-11 21:26:10
问题 I use a table in docx file with the following rows: [b.num;block=w:tr] [b.name] In PHP, I use $TBS->MergeBlock('b', $data_1); which adds the content from the $data_1 array. The question is, how can I dynamically control the text color in each row, e.g. if the name is "John", then mark it in red, otherwise use blue? 回答1: I can suggest two solutions. 1) use conditional sections For this, use one row for each possibility: [b.num;block=w:tr;when '[b.name]'='John'] (red) [b.name] [b.num;block=w:tr

Difficulty creating lxml Element subclass

不羁岁月 提交于 2019-12-11 18:02:15
问题 I’m trying to create a subclass of the Element class. I’m having trouble getting started though. from lxml import etree try: import docx except ImportError: from docx import docx class File(etree.ElementBase): def _init(self): etree.ElementBase._init(self) self.body = self.append(docx.makeelement('body')) f = File() relationships = docx.relationshiplist() title = 'File' subject = 'A very special File' creator = 'Me' keywords = ['python', 'Office Open XML', 'Word'] coreprops = docx

How create three TOC with diffrent styles in docx by java?

不打扰是莪最后的温柔 提交于 2019-12-11 15:14:50
问题 How can I create three or more TOC in docx file that one of them is for Headings level 1, 2, 3 and others are for another styles which are created by program? For example, I create a style for table title and I want to create a TOC for paragraphs with this style. And I want these TOCs to be in special paragraphs not at the end of the file. Which one is better to do this, Apache-poi? docx4j ? Aspose? I write my other code with apache-poi. 回答1: Using Aspose.Words for Java, you can use

Running VBA macros in documents created using template

╄→尐↘猪︶ㄣ 提交于 2019-12-11 11:12:00
问题 I have macro-enabled templete (.dotm) wich has number of macros generally connected with adding and deleting parts of document using custom building blocks stored in the template. When I execute macros at the actual template file everything works smooth. But when I try to execute them in documents created using this template macros stop working after one run of the particular function (attached to checkbox). Additionally in some cases checkboxes turn into pictures when saving documents as

How to embed file to word docx?

谁都会走 提交于 2019-12-11 10:34:02
问题 I'm trying to insert a file programmatically (*.zip for example) into an existing docx file. I looked at the docx open library but it doesn't have the function there. Also tried using Microsoft.Office.Interop.Word. I created a word document with a table, and I'm trying to insert a file into a cell inside the table. Word.Application wordApp = new Word.Application(); wordApp.Visible = false; Word.Document doc = new Word.Document(); doc = wordApp.Documents.Open(Environment.CurrentDirectory + "\

AngularJS FileSaver producing empty file

ε祈祈猫儿з 提交于 2019-12-11 09:54:26
问题 I have the following PHP code which outputs a document from a web service: $db->where('documentReference', $post->documentID); $results = $db->getOne('documents'); $filelocation = 'doc/'; $file = $results['filename']; header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document'); header('Content-Length: ' . filesize($filelocation.$file)); header('Content-disposition: attachment; filename="'.$file.'"'); readfile($filelocation.$file); And on the front end..

Phpdocx word documents are corrupt when adding images

孤者浪人 提交于 2019-12-11 09:19:14
问题 I'm using Phpdocx 2.5 to convert html to docx. I'm using the embedHTML method with 'downloadImages' parameter set to true; When the html doesn't contain any images, document is generated just fine. When images are added, the resulting document seems to be corrupt. The details of the errors show a standard "File is corrupt and cannot be opened" message. However, Word also displays a "Do you want to recover the content" message which if clicked, displays the content (with images) which look

Extract DOCX Comments

纵饮孤独 提交于 2019-12-11 08:55:07
问题 I'm a teacher. I want a list of all the students who commented on the essay I assigned, and what they said. The Drive API stuff was too challenging for me, but I figured I could download them as a zip and parse the XML. The comments are tagged in w:comment tags, with w:t for the comment text and . It should be easy, but XML (etree) is killing me. via the tutorial (and official Python docs): z = zipfile.ZipFile('test.docx') x = z.read('word/comments.xml') tree = etree.XML(x) Then I do this: