#NEWLINE# def export_to_excel( vuln_info , output_file_name , lang = 'en' , template = 'generic' ) : #NEWLINE# #INDENT# '\n    Export Vulnerability info to excel file.\n\n    :param vuln_info: Vulnerability list info\n    :type vuln_info: list(Vulnerability)\n\n    :param output_file_name: filename to save word file,\n    :type output_file_name: str\n\n    :param lang: output lang\n    :type lang: str\n\n    :param template: Excel template\n    :type template: str\n\n    :raises: TypeError\n    ' #NEWLINE# if ( not isinstance ( vuln_info , list ) ) : #NEWLINE# #INDENT# raise TypeError ( ( "Expected list, got '%s' instead" % type ( vuln_info ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# for x in vuln_info : #NEWLINE# #INDENT# if ( not isinstance ( x , Vulnerability ) ) : #NEWLINE# #INDENT# raise TypeError ( ( "Expected Vulnerability, got '%s' instead" % type ( x ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not isinstance ( output_file_name , str ) ) : #NEWLINE# #INDENT# raise TypeError ( ( "Expected basestring, got '%s' instead" % type ( output_file_name ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not output_file_name ) : #NEWLINE# #INDENT# raise ValueError ( 'output_file_name must has a valid name.' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not output_file_name . endswith ( 'xlsx' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Invalid filename. Filename must ends in .xlsx.' ) #NEWLINE# #UNINDENT# if ( template == 'generic' ) : #NEWLINE# #INDENT# _export_generic_format ( output_file_name , vuln_info , output_file_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Unknown format' )