From 2e3725ed8a17340be8d5fb81d163c99740f003b4 Mon Sep 17 00:00:00 2001 From: Yukilas Date: Thu, 27 Jun 2013 15:44:21 +0200 Subject: [PATCH] Adds indentation options for paragraphs. --- docx.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docx.py b/docx.py index 3ab37bb..ec9fe56 100755 --- a/docx.py +++ b/docx.py @@ -141,7 +141,7 @@ def pagebreak(type='page', orient='portrait'): return pagebreak -def paragraph(paratext, style='BodyText', breakbefore=False, jc='left'): +def paragraph(paratext, style='BodyText', breakbefore=False, jc='left', ind=None): '''Make a new paragraph element, containing a run, and some text. Return the paragraph element. @@ -150,6 +150,14 @@ def paragraph(paratext, style='BodyText', breakbefore=False, jc='left'): see http://www.schemacentral.com/sc/ooxml/t-w_ST_Jc.html for a full list + @param int ind: Paragraph indentation. You can provide an integer, this one + will be used as the left indentation. Or you can provide a + dictionary to customize all the different indentations, see + http://www.schemacentral.com/sc/ooxml/e-w_ind-1.html. + Example: + ind=1200 + ind={"left": 1200, "right": 800} + If paratext is a list, spawn multiple run/text elements. Support text styles (paratext must then be a list of lists in the form /