#NEWLINE# def generate_to( self , worksheet , row ) : #NEWLINE# #INDENT# 'Generate row report.\n\n        Generates a row report of the item represented by this instance and\n        inserts it into a given worksheet at a specified row number.\n\n        :param worksheet: Reference to a worksheet in which to insert row\n        report.\n\n        :param row: Row number.\n        ' #NEWLINE# super ( ItemImage , self ) . generate_to ( worksheet , row ) #NEWLINE# embedded = False #NEWLINE# fmt = self . generator . formats #NEWLINE# worksheet . write ( row , 3 , 'image' , fmt [ 'type_image' ] ) #NEWLINE# worksheet . write_url ( row , 5 , self . data [ 0 ] , fmt [ 'link' ] ) #NEWLINE# try : #NEWLINE# #INDENT# if self . data : #NEWLINE# #INDENT# image = self . resize_image ( StringIO ( self . data [ 1 ] ) ) #NEWLINE# worksheet . insert_image ( row , 4 , 'image' , { #NEWLINE# #INDENT# 'image_data' : image , #NEWLINE# #UNINDENT# } ) #NEWLINE# embedded = True #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if ( not embedded ) : #NEWLINE# #INDENT# url = self . data [ 0 ] #NEWLINE# if url : #NEWLINE# #INDENT# image = self . resize_image ( BytesIO ( urlopen ( url ) . read ( ) ) ) #NEWLINE# worksheet . insert_image ( row , 4 , url , { #NEWLINE# #INDENT# 'image_data' : image , #NEWLINE# #UNINDENT# } ) #NEWLINE# embedded = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# worksheet . write ( row , 4 , '<unavailable>' ) #NEWLINE# #UNINDENT# #UNINDENT# if image : #NEWLINE# #INDENT# worksheet . set_row ( row , 40 )