Skip to content
Advertisement

Tag: python-docx

Save doc file as pdf file using python

I want to save a doc file as pdf using python, I tried so many solution but I couldn’t find the right one. This is my code, I tried to make the output file as a pdf file but it didn’t open. Any help is highly appreciated : Answer There is a Python package called docx2pdf. You can use it

Python-docx: Find and replace all placeholder numbers in Word doc with random numbers

I’m having trouble finding and replacing all occurrences of several placeholders within paragraphs of a Word file. It’s for a gamebook, so I’m trying to sub random entry numbers for the placeholders used while drafting the book. All placeholders begin with “#” (e.g. #1-5, #22-1, etc.). Set numbers, like the first entry (which will always be “1”), don’t have the

How to add a Sectional Break in word using python-docx

I have been trying to add a sectional break into my word document using python-docx. I basically want to add a sectional break before every paragraph having style = “heading 1”. I have written the following code. The code goes as follows: 1)get the total number of paragraphs 2)find the index of the paragraph with style = “heading 1” 3)add

How do I change Heading font face and size in python-docx?

I filed this as a python-docx issue: https://github.com/python-openxml/python-docx/issues/805 but was requested to open a discussion here. https://python-docx.readthedocs.io/en/latest/user/styles-using.html implies that I should be able to change Heading font styles like this: But that doesn’t work: the resulting document uses Calibri for all headings. (They’re also blue and Heading 1 has an underline, which I also need to eliminate somehow.) It also

Advertisement