#NEWLINE# def _store_workbook( self ) : #NEWLINE# #INDENT# packager = Packager ( ) #NEWLINE# if ( not self . worksheets ( ) ) : #NEWLINE# #INDENT# self . add_worksheet ( ) #NEWLINE# #UNINDENT# if ( self . worksheet_meta . activesheet == 0 ) : #NEWLINE# #INDENT# self . worksheets_objs [ 0 ] . selected = 1 #NEWLINE# self . worksheets_objs [ 0 ] . hidden = 0 #NEWLINE# #UNINDENT# for sheet in self . worksheets ( ) : #NEWLINE# #INDENT# if ( sheet . index == self . worksheet_meta . activesheet ) : #NEWLINE# #INDENT# sheet . active = 1 #NEWLINE# #UNINDENT# #UNINDENT# self . _prepare_sst_string_data ( ) #NEWLINE# self . _prepare_vml ( ) #NEWLINE# self . _prepare_defined_names ( ) #NEWLINE# self . _prepare_drawings ( ) #NEWLINE# self . _add_chart_data ( ) #NEWLINE# self . _prepare_tables ( ) #NEWLINE# packager . _add_workbook ( self ) #NEWLINE# packager . _set_tmpdir ( self . tmpdir ) #NEWLINE# packager . _set_in_memory ( self . in_memory ) #NEWLINE# xml_files = packager . _create_package ( ) #NEWLINE# packager = None #NEWLINE# xlsx_file = ZipFile ( self . filename , 'w' , compression = ZIP_DEFLATED , allowZip64 = self . allow_zip64 ) #NEWLINE# for ( os_filename , xml_filename , is_binary ) in xml_files : #NEWLINE# #INDENT# if self . in_memory : #NEWLINE# #INDENT# if is_binary : #NEWLINE# #INDENT# xlsx_file . writestr ( xml_filename , os_filename . getvalue ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# xlsx_file . writestr ( xml_filename , os_filename . getvalue ( ) . encode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# xlsx_file . write ( os_filename , xml_filename ) #NEWLINE# os . remove ( os_filename ) #NEWLINE# #UNINDENT# #UNINDENT# xlsx_file . close ( )