(self, wb, title="report")
return response
Take a workbook and return a xlsx file response
Take a workbook and return a xlsx file response
Take a workbook and return a xlsx file response
def build_xlsx_response(self, wb, title="report"):
        """ Take a workbook and return a xlsx file response """
        title = generate_filename(title, '.xlsx')
        myfile = BytesIO()
        myfile.write(save_virtual_workbook(wb))
        response = HttpResponse(
            myfile.getvalue(),
            content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
        response['Content-Disposition'] = 'attachment; filename=%s' % title
        response['Content-Length'] = myfile.tell()
        return response
def build_xlsx_response ( self , wb , title = "report" ) : title = generate_filename ( title , '.xlsx' ) myfile = BytesIO ( ) myfile . write ( save_virtual_workbook ( wb ) ) response = HttpResponse ( myfile . getvalue ( ) , content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) response [ 'Content-Disposition' ] = 'attachment; filename=%s' % title response [ 'Content-Length' ] = myfile . tell ( ) return response