Я хочу покрасить строку с выводом.Как я могу добавить свойства в эту строку.Как будто я хочу раскрасить этот ряд.Как я могу добавить цвет к этой строке в 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