Skip to content

Commit 5bdc14f

Browse files
2 parents 6f9ed87 + 10abc68 commit 5bdc14f

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

pyxlsb2/ptgs.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def stringify(self, tokens, workbook):
633633

634634
supporting_link, first_sheet_idx, last_sheet_idx = workbook.resolve_extern_sheet_id(self.extern_sheet_idx)
635635
address = None
636-
if supporting_link.brt == rt.SUP_SAME or supporting_link.brt == rt.SUP_SELF:
636+
if supporting_link.brt in rt._SUP_LINK_TYPES:
637637
if first_sheet_idx == last_sheet_idx and first_sheet_idx >= 0:
638638
address = workbook.sheets[first_sheet_idx].name + '!' + cell_add
639639
elif first_sheet_idx == last_sheet_idx and first_sheet_idx == -1:
@@ -698,13 +698,16 @@ def stringify(self, tokens, workbook):
698698
,self.last_row_rel)
699699
supporting_link, first_sheet_idx, last_sheet_idx = workbook.resolve_extern_sheet_id(self.extern_sheet_idx)
700700

701+
cell_add_first = self.cell_address(self.first_col, self.first_row, self.first_col_rel, self.first_row_rel)
702+
cell_add_last = self.cell_address(self.last_col, self.last_row, self.last_col_rel, self.last_row_rel)
703+
701704
address = None
702-
if supporting_link.brt == rt.SUP_SAME or supporting_link.brt == rt.SUP_SELF:
705+
if supporting_link.brt in rt._SUP_LINK_TYPES:
703706
if first_sheet_idx == last_sheet_idx and first_sheet_idx >= 0:
704707
address = workbook.sheets[first_sheet_idx].name + '!' + first + ':' + last
705708

706709
if address is None:
707-
print("AreaPtg External Address Not Supported {0} {1} {2}".format(cell_add, first_sheet_idx, last_sheet_idx))
710+
print("AreaPtg External Address Not Supported {0}:{1} {2} {3}".format(cell_add_first, cell_add_last, first_sheet_idx, last_sheet_idx))
708711
#raise NotImplementedError('External address not supported')
709712

710713
return address

pyxlsb2/recordtypes.py

+2
Original file line numberDiff line numberDiff line change
@@ -779,3 +779,5 @@
779779

780780
_by_name = {k: v for k, v in locals().items() if not k.startswith('_')}
781781
_by_num = {v: k for k, v in _by_name.items()}
782+
# https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/8cc503eb-12ab-4a47-bbc7-2dbcef47150b
783+
_SUP_LINK_TYPES = {SUP_SELF, SUP_SAME, SUP_ADDIN, SUP_BOOK_SRC}

pyxlsb2/workbook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _parse(self):
6161
self.externals = {'SupportingLinks':[], 'ExternalSheets': []}
6262
elif rectype == rt.EXTERN_SHEET:
6363
self.externals['ExternalSheets'] = rec
64-
elif rectype == rt.SUP_SELF or rectype == rt.SUP_SAME:
64+
elif rectype in rt._SUP_LINK_TYPES:
6565
self.externals['SupportingLinks'].append(rec)
6666
elif rectype == rt.NAME:
6767
self.list_names.append(rec.name)

pyxlsb2/worksheet.py

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def rows(self, sparse=True):
8686
if rec.v is not None and rec.c is not None:
8787
row._add_cell(rec.c, rec.v, rec.f, rec.style)
8888

89-
9089
elif rectype >= rt.CELL_BLANK and rectype <= rt.FMLA_ERROR:
9190
if rec.v is not None and rec.c is not None:
9291
row._add_cell(rec.c, rec.v, rec.f, rec.style)

0 commit comments

Comments
 (0)