How do i set table style
See original GitHub issueHi scanny.
How do i set table style?
When i using
document.add_table(rows=len(table_data), cols=len(table_data[0]),style="TableGrid")
I search the API , but i didn’t find method do it, I need set table size and width and height and color and so on.
“Cell class” also didn’t find any method support it.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:3
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Change Table Style in Word
Click inside the table. · Click the Design tab in the Table Tools ribbon group. · (Optional) Click the Table Styles More button...
Read more >How to Format Microsoft Word Tables Using Table Styles ...
Set a default table style · Click in the table. · Click the Table Tools Design or Table Design tab in the Ribbon....
Read more >How To Style a Table with CSS
To begin, open styles.css in your text editor. The :nth-child() pseudo-class works by applying it to sibling elements. In this case, ...
Read more >CSS Styling Tables
To specify table borders in CSS, use the border property. The example below specifies a solid border for <table>, <th>, and <td> elements:...
Read more >Word 2013: Tables - GCF Global
To apply a table style: ... Click anywhere on the table, then click the Design tab on the right side of the Ribbon....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

What you need to do is open a document in your Document() call, not just use the default.
After that you start a new document in python-docx using
document = Document('template.docx')and it will use the file you customized. The table style you customized will be available to apply to tables you make with python-pptx. The table style name is the same as it is in Word, with all spaces removed. For example, ‘Light Shading - Accent 1’ becomes ‘LightShading-Accent1’.You have to set it using Document object which contains all the styles. https://python-docx.readthedocs.io/en/latest/user/styles-understanding.html#table-styles-in-default-template Like this
document = Document() table.style = document.styles[‘Table Grid’]