def to_excel(self):
"""View selection in Excel"""
if xw is None:
QMessageBox.critical(self, "Error", "to_excel() is not available because xlwings is not installed")
data = self._selection_data()
if data is None:
return
# convert (row) generators to lists then array
# TODO: the conversion to array is currently necessary even though xlwings will translate it back to a list
# anyway. The problem is that our lists contains numpy types and especially np.str_ crashes xlwings.
# unsure how we should fix this properly: in xlwings, or change _selection_data to return only standard
# Python types.
xw.view(np.array([list(r) for r in data]))
评论列表
文章目录