python - Bold a table cells -


i have following code:

table = document.add_table(rows=1, cols=8) hdr_cells = table.rows[0].cells hdr_cells[0].text = 'name' hdr_cells[1].text = 'surname' hdr_cells[2].text = 'telephone' (...) 

is possible make cells bolded? that:

hdr_cells[0].text = 'name' hdr_cells[1].text = 'surname' hdr_cells[2].text = 'telephone' hdr_cells[0].text.bold = true hdr_cells[1].text.bold = true hdr_cells[2].text.bold = true 

this should trick in particular case:

hdr_cells[0].paragraphs[0].add_run('name').bold = true 

or, more step-by-step:

col_names = ('name', 'surname', 'telephone') table = document.add_table(rows=1, cols=len(col_names)) hdr_cells = table.rows[0].cells idx, name in enumerate(col_names):     paragraph = hdr_cells[idx].paragraphs[0]     run = paragraph.add_run(name)     run.bold = true 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -