I use python-docx and want to change the format of a left border of a specific cell only. I don’t know how to do it
def index(request, pk):
detailmodel100 = DocModelWord.objects.filter(code_docmodel=100)
company=Company.objects.get(pk=pk)
document = Document()
header = document.sections[0].header
htable=header.add_table(1, 3, Inches(10))
htab_cells=htable.rows[0].cells
ht0=htab_cells[0].add_paragraph()
kh=ht0.add_run()
kh.add_picture('media/'+str(company.file), width=Inches(2))
htab_cells[2].add_paragraph(str(company.name)).alignment=WD_ALIGN_PARAGRAPH.LEFT
htab_cells[2].add_paragraph(str(company.adresse)).alignment=WD_ALIGN_PARAGRAPH.LEFT
htab_cells[2].add_paragraph(str(company.city)).alignment=WD_ALIGN_PARAGRAPH.LEFT
shading_elm = parse_xml(r'<w:shd {} w:fill="D9D9D9"/>'.format(nsdecls('w')))
htab_cells[2]._tc.get_or_add_tcPr().append(shading_elm)
response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.wordprocessingml.document')
response['Content-Disposition'] = 'attachment; filename='+str(company.name)+'_Lettre.docx'
document.save(response)
return response