Commit ad905de0 authored by CharlieC's avatar CharlieC
Browse files

Read row and column breaks in as a list.

--HG--
branch : 2.6
parent eed3399eb653
......@@ -69,6 +69,7 @@ PROPERTIES_TAG = '{%s}sheetPr' % SHEET_MAIN_NS
VIEWS_TAG = '{%s}sheetViews' % SHEET_MAIN_NS
FORMAT_TAG = '{%s}sheetFormatPr' % SHEET_MAIN_NS
ROW_BREAK_TAG = '{%s}rowBreaks' % SHEET_MAIN_NS
COL_BREAK_TAG = '{%s}colBreaks' % SHEET_MAIN_NS
SCENARIOS_TAG = '{%s}scenarios' % SHEET_MAIN_NS
DATA_TAG = '{%s}sheetData' % SHEET_MAIN_NS
DIMENSION_TAG = '{%s}dimension' % SHEET_MAIN_NS
......@@ -103,6 +104,7 @@ class WorkSheetParser(object):
self.formatting = []
self.legacy_drawing = None
self.merged_cells = None
self.page_breaks = []
def parse(self):
......@@ -112,6 +114,8 @@ class WorkSheetParser(object):
EXT_TAG: self.parse_extensions,
CF_TAG: self.parse_formatting,
LEGACY_TAG: self.parse_legacy,
ROW_BREAK_TAG: self.parse_breaks,
COL_BREAK_TAG: self.page_breaks,
}
properties = {
......@@ -124,7 +128,6 @@ class WorkSheetParser(object):
PROPERTIES_TAG: ('sheet_properties', WorksheetProperties),
VIEWS_TAG: ('views', SheetViewList),
FORMAT_TAG: ('sheet_format', SheetFormatProperties),
ROW_BREAK_TAG: ('page_breaks', PageBreak),
SCENARIOS_TAG: ('scenarios', ScenarioList),
TABLE_TAG: ('tables', TablePartList),
HYPERLINK_TAG: ('hyperlinks', HyperlinkList),
......@@ -298,6 +301,11 @@ class WorkSheetParser(object):
self.legacy_drawing = obj.id
def parse_breaks(self, element):
brk = PageBreak.from_tree(element)
self.page_breaks.append(brk)
class WorksheetReader(object):
"""
Create a parser and apply it to a workbook
......
......@@ -662,7 +662,7 @@ class TestWorksheetParser:
for _ in parser.parse():
pass
assert parser.page_breaks == expected_pagebreak
assert parser.page_breaks == [expected_pagebreak]
def test_scenarios(self, WorkSheetParser):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment