Django Python中的彩色CSV列

Django Python中的彩色CSV列,python,django,django-views,Python,Django,Django Views,我想用我正在输出的颜色给一行上色。如何向该行添加属性。就像我想给那一排涂颜色一样。如何向csv文件中的该行添加颜色。如何添加中心、粗体等属性 import csv from django.http import HttpResponse def GenerateCompanyCSV(request): # Create the HttpResponse object with the appropriate CSV header. response = HttpResponse

我想用我正在输出的颜色给一行上色。如何向该行添加属性。就像我想给那一排涂颜色一样。如何向csv文件中的该行添加颜色。如何添加中心、粗体等属性

import csv
from django.http import HttpResponse

def GenerateCompanyCSV(request):
    # Create the HttpResponse object with the appropriate CSV header.
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="Company_Report-%s.csv"' % datetime.date.today()

    query_set = Company.objects.exclude(id=1).exclude(
                            company_is_deleted=True
                            ).annotate(
                            number_of_company_users=Count('userprofile')
                        ) 

    output = []

    for query in query_set:
        output.append([
            query.company_name, 
            query.company_email, 
            query.number_of_company_users, 
            query.company_created, 
            query.company_monthly_payment, 
            query.company_tab_opts, 
            query.company_status, 
            ])

    writer = csv.writer(response)
    # Output Color for this row
    writer.writerow(['Company Name', 'Company Email', 'Count Of Total Users', 'Created Date', 'Current Monthly Payment', 'Is TABopts Customer', 'Status'])
    #CSV Data
    writer.writerows(output)

    return response
我不能那样做

您需要一个像

可能重复的