示例#1
0
    def __init__(self, parent_workbook, title):
        Worksheet.__init__(self, parent_workbook, title)

        self._max_col = 0
        self._max_row = 0
        self._parent = parent_workbook

        self._fileobj_header_name = create_temporary_file(suffix='.header')
        self._fileobj_content_name = create_temporary_file(suffix='.content')
        self._fileobj_name = create_temporary_file()

        self._shared_date = SharedDate()
        self._string_builder = self._parent.strings_table_builder
示例#2
0
    def __init__(self, parent_workbook, title):
        Worksheet.__init__(self, parent_workbook, title)

        self._max_col = 0
        self._max_row = 0
        self._parent = parent_workbook

        self._fileobj_header_name = create_temporary_file(suffix='.header')
        self._fileobj_content_name = create_temporary_file(suffix='.content')
        self._fileobj_name = create_temporary_file()

        self._shared_date = SharedDate()
        self._string_builder = self._parent.strings_table_builder
    def __init__(self, parent_workbook, title, workbook_name, sheet_codename, xml_source, string_table):

        Worksheet.__init__(self, parent_workbook, title)
        self._workbook_name = workbook_name
        self._sheet_codename = sheet_codename
        self._xml_source = xml_source
        self._string_table = string_table

        min_col, min_row, max_col, max_row = read_dimension(xml_source=xml_source)

        self._max_row = max_row
        self._max_column = max_col
        self._dimensions = "%s%s:%s%s" % (min_col, min_row, max_col, max_row)

        self._shared_date = SharedDate(base_date=parent_workbook.excel_base_date)
示例#4
0
    def __init__(self, parent_workbook, title, workbook_name, sheet_codename,
                 xml_source, string_table):

        Worksheet.__init__(self, parent_workbook, title)
        self._workbook_name = workbook_name
        self._sheet_codename = sheet_codename
        self._xml_source = xml_source
        self._string_table = string_table

        min_col, min_row, max_col, max_row = read_dimension(
            xml_source=xml_source)

        self._max_row = max_row
        self._max_column = max_col
        self._dimensions = '%s%s:%s%s' % (min_col, min_row, max_col, max_row)

        self._shared_date = SharedDate(
            base_date=parent_workbook.excel_base_date)
示例#5
0
def read_worksheet(xml_source, parent, preset_title, string_table,
                   style_table, workbook_name=None, sheet_codename=None):
    """Read an xml worksheet"""
    if workbook_name and sheet_codename:
        ws = IterableWorksheet(parent, preset_title, workbook_name,
                sheet_codename, xml_source, string_table)
    else:
        ws = Worksheet(parent, preset_title)
        fast_parse(ws, xml_source, string_table, style_table)
    return ws
示例#6
0
    def create_sheet(self, index=None, title=None):
        """Create a worksheet (at an optional index).

        :param index: optional position at which the sheet will be inserted
        :type index: int

        """

        if self.__optimized_read:
            raise ReadOnlyWorkbookException(
                'Cannot create new sheet in a read-only workbook')

        if self.__optimized_write:
            new_ws = DumpWorksheet(parent_workbook=self, title=title)
        else:
            if title is not None:
                new_ws = Worksheet(parent_workbook=self, title=title)
            else:
                new_ws = Worksheet(parent_workbook=self)

        self.add_sheet(worksheet=new_ws, index=index)
        return new_ws
示例#7
0
    def __init__(self, optimized_write=False, encoding='utf-8'):
        self.worksheets = []
        self._active_sheet_index = 0
        self._named_ranges = []
        self.properties = DocumentProperties()
        self.style = Style()
        self.security = DocumentSecurity()
        self.__optimized_write = optimized_write
        self.__optimized_read = False
        self.__thread_local_data = threading.local()
        self.strings_table_builder = StringTableBuilder()
        self.loaded_theme = None

        self.encoding = encoding

        if not optimized_write:
            self.worksheets.append(Worksheet(self))