Avoid error importing spreadsheet with deleted sheet (#19757)

This fix was proposed by pageeddie on https://github.com/FreeCAD/FreeCAD/issues/19757
This commit is contained in:
Gonzalo
2025-05-31 19:05:57 -03:00
committed by Chris Hennes
parent b1ea693492
commit bcfda35b42

View File

@@ -372,8 +372,8 @@ def handleWorkBook(theBook, sheetDict, Doc):
nameRef = sheetAtts.getNamedItem("name")
sheetName = getText(nameRef.childNodes)
# print("table name: ", sheetName)
idRef = sheetAtts.getNamedItem("sheetId")
sheetFile = "sheet" + getText(idRef.childNodes) + ".xml"
idRef = sheetAtts.getNamedItem("r:id")
sheetFile = "sheet" + getText(idRef.childNodes)[3:] + ".xml"
# print("sheetFile: ", sheetFile)
# add FreeCAD-spreadsheet
sheetDict[sheetName] = (Doc.addObject("Spreadsheet::Sheet", sheetName), sheetFile)