Skip to content

Commit bd5b68d

Browse files
author
quentin.desabre
committed
Sort variable to avoid sub string replacement
1 parent 5850e64 commit bd5b68d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lotemplate/Statement/CalcTableStatement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def fill(doc: XComponent, variable: str, value) -> None:
9696
copycell=sheet.getCellByPosition(StartColumn,StartRow)
9797
rangetocopy=sheet.getCellRangeByPosition(StartColumn,StartRow,EndColumn,EndRow )
9898
sheet.copyRange(copycell.CellAddress,doc.NamedRanges.getByName(variable).getReferredCells().getRangeAddress())
99-
for key, mylist in value.items():
99+
for key, mylist in sorted(value.items(), key=lambda x: len(x[0]), reverse=True):
100100
try:
101101
CalcTextStatement.fill(rangetocopy,'&'+key,mylist['value'][i])
102102
except IndexError:

0 commit comments

Comments
 (0)