#NEWLINE# def calculate_dimension( self ) : #NEWLINE# #INDENT# 'Return the minimum bounding range for all cells containing data.' #NEWLINE# if self . _cells : #NEWLINE# #INDENT# rows = set ( ) #NEWLINE# cols = set ( ) #NEWLINE# for ( row , col ) in self . _cells : #NEWLINE# #INDENT# rows . add ( row ) #NEWLINE# cols . add ( col ) #NEWLINE# #UNINDENT# max_row = max ( rows ) #NEWLINE# max_col = max ( cols ) #NEWLINE# min_col = min ( cols ) #NEWLINE# min_row = min ( rows ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return 'A1:A1' #NEWLINE# #UNINDENT# return ( '%s%d:%s%d' % ( get_column_letter ( min_col ) , min_row , get_column_letter ( max_col ) , max_row ) )