importXLSX.py | importXLSX.py | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
- references to cells with strings are working | - references to cells with strings are working | |||
known issues: | known issues: | |||
- units are not imported | - units are not imported | |||
- string support is minimal, the same as in FreeCAD | - string support is minimal, the same as in FreeCAD | |||
''' | ''' | |||
import zipfile | import zipfile | |||
import xml.dom.minidom | import xml.dom.minidom | |||
import FreeCAD as App | import FreeCAD as App | |||
import sys | ||||
try: import FreeCADGui | try: import FreeCADGui | |||
except ValueError: gui = False | except ValueError: gui = False | |||
else: gui = True | else: gui = True | |||
if open.__module__ in ['__builtin__','io']: | if open.__module__ in ['__builtin__','io']: | |||
pythonopen = open | pythonopen = open | |||
# The sepToken structure is used in the tokenizer functions isKey and | # The sepToken structure is used in the tokenizer functions isKey and | |||
# getNextToken. | # getNextToken. | |||
skipping to change at line 359 | skipping to change at line 360 | |||
valueRef = cell.getElementsByTagName("v") | valueRef = cell.getElementsByTagName("v") | |||
#print('valueRef: ', valueRef) | #print('valueRef: ', valueRef) | |||
if len(valueRef)==1: | if len(valueRef)==1: | |||
valueRef = cell.getElementsByTagName("v")[0] | valueRef = cell.getElementsByTagName("v")[0] | |||
if valueRef: | if valueRef: | |||
theValue = getText(valueRef.childNodes) | theValue = getText(valueRef.childNodes) | |||
#print("theValue: ", theValue) | #print("theValue: ", theValue) | |||
if cellType == 'n': | if cellType == 'n': | |||
actCellSheet.set(ref, theValue) | actCellSheet.set(ref, theValue) | |||
if cellType == 's': | if cellType == 's': | |||
actCellSheet.set(ref, (sList[int(theValue)]).encode('utf8')) | if sys.version_info.major >= 3: | |||
actCellSheet.set(ref, (sList[int(theValue)])) | ||||
else: | ||||
actCellSheet.set(ref, (sList[int(theValue)]).encode('utf8') | ||||
) | ||||
def handleWorkBook(theBook, sheetDict, Doc): | def handleWorkBook(theBook, sheetDict, Doc): | |||
theSheets = theBook.getElementsByTagName("sheet") | theSheets = theBook.getElementsByTagName("sheet") | |||
#print("theSheets: ", theSheets) | #print("theSheets: ", theSheets) | |||
for sheet in theSheets: | for sheet in theSheets: | |||
sheetAtts = sheet.attributes | sheetAtts = sheet.attributes | |||
nameRef = sheetAtts.getNamedItem("name") | nameRef = sheetAtts.getNamedItem("name") | |||
sheetName = getText(nameRef.childNodes) | sheetName = getText(nameRef.childNodes) | |||
#print("table name: ", sheetName) | #print("table name: ", sheetName) | |||
idRef = sheetAtts.getNamedItem("sheetId") | idRef = sheetAtts.getNamedItem("sheetId") | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |