Commit c2d3cf21 authored by Sanjay Yadav's avatar Sanjay Yadav

ENH: enhanced text and replace functioanlity with custom functions.

parent c755159a
Pipeline #31494 failed with stage
in 52 seconds
......@@ -44,7 +44,8 @@ def text(shape, spec, data):
if not shape.has_text_frame:
logging.error('"%s" is not a TextShape to apply text:', shape.name)
return
if not isinstance(data, (dict,)):
data = {'data': data}
run_flag = True
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
......@@ -59,6 +60,8 @@ def replace(shape, spec, data):
if not shape.has_text_frame:
logging.error('"%s" is not a TextShape to apply text:', shape.name)
return
if not isinstance(data, (dict,)):
data = {'data': data}
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
for old, new in spec['replace'].items():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment