문제

I found python-docx, it looks very smart, but I have to do some tasks that are not well documented.

I need to open a .docx template, with a table within, ad for all the istances present in a list previously created, I have to format them in the table inside the template.

도움이 되었습니까?

해결책

Probably I've found a solution. It depends of document.xpath, a way to take a map of it is decompress the .docx and read the ./word/document.xml file.

PATH_CELL = 'the path you individuate in document.xml'

docbody = document.xpath('/w:document/w:body'+PATH_CELL, 
namespaces=nsprefixes)[0]

print 'Replacing ...',
docbody = replace(docbody,'Welcome','Hello') 

I've found this way to run the game. Any else ?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top