Skip to content

Commit

Permalink
fix : revert TextShape testing (#26)
Browse files Browse the repository at this point in the history
* fix : revert TextShape testing

* README updated
  • Loading branch information
philippe-levan authored Sep 4, 2023
1 parent 61647e8 commit 844b9a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ For trying to fix these problems, you can try:
- use variable formatting instead of the one of the character before

## Versions :
- v1.2.8, 2023-09-01 :
- fix bug in TextShape var replacement
- v1.2.7, 2023-08-30 :
- Upgrade to debian bookworm slim
- v1.2.6, 2023-08-30 :
Expand Down
8 changes: 2 additions & 6 deletions lotemplate/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,7 @@ def text_fill(doc, variable: str, value: str) -> None:

for page in doc.getDrawPages():
for shape in page:
# note : we changed this test in order to manage more possible shapes.
# if shape.getShapeType() == "com.sun.star.drawing.TextShape":
if hasattr(shape, 'String'):
if shape.getShapeType() == "com.sun.star.drawing.TextShape":
shape.String = shape.String.replace(variable, value)

def html_fill(doc, variable: str, value: str) -> None:
Expand All @@ -994,9 +992,7 @@ def html_fill(doc, variable: str, value: str) -> None:

for page in doc.getDrawPages():
for shape in page:
# note : we changed this test in order to manage more possible shapes.
# if shape.getShapeType() == "com.sun.star.drawing.TextShape":
if hasattr(shape, 'String'):
if shape.getShapeType() == "com.sun.star.drawing.TextShape":
shape.String = shape.String.replace(variable, value)
# we wanted to use the pasteHtml function, but it doesn't work in a shape
# cursor = shape.createTextCursor()
Expand Down

0 comments on commit 844b9a0

Please sign in to comment.