@@ -115,9 +115,9 @@ supports indexed access, like a list:: |
115 | 115 | row.cells[0].text = 'Foo bar to you.' |
116 | 116 | row.cells[1].text = 'And a hearty foo bar to you too sir!' |
117 | 117 |
|
118 | | -The ``.rows`` and ``.columns`` collections on a table are iterable, so you can |
119 | | -use them directly in a ``for`` loop. Same with the ``.cells`` sequences on |
120 | | -a row or column:: |
| 118 | +The ``.rows`` and ``.columns`` collections on a table are iterable, so you |
| 119 | +can use them directly in a ``for`` loop. Same with the ``.cells`` sequences |
| 120 | +on a row or column:: |
121 | 121 |
|
122 | 122 | for row in table.rows: |
123 | 123 | for cell in row.cells: |
@@ -137,7 +137,11 @@ This can be very handy for the variable length table scenario we mentioned |
137 | 137 | above:: |
138 | 138 |
|
139 | 139 | # get table data ------------- |
140 | | - items = get_things_from_database_or_something() |
| 140 | + items = ( |
| 141 | + (7, '1024', 'Plush kittens'), |
| 142 | + (3, '2042', 'Furbees'), |
| 143 | + (1, '1288', 'French Poodle Collars, Deluxe'), |
| 144 | + ) |
141 | 145 |
|
142 | 146 | # add table ------------------ |
143 | 147 | table = document.add_table(1, 3) |
@@ -229,14 +233,11 @@ thing. You can also apply a style afterward. These two lines are equivalent to |
229 | 233 | the one above:: |
230 | 234 |
|
231 | 235 | paragraph = document.add_paragraph('Lorem ipsum dolor sit amet.') |
232 | | - paragraph.style = 'ListBullet' |
| 236 | + paragraph.style = 'List Bullet' |
233 | 237 |
|
234 | | -The style is specified using its style ID, 'ListBullet' in this example. |
235 | | -Generally, the style ID is formed by removing the spaces in the style name as |
236 | | -it appears in the Word user interface (UI). So the style 'List Number 3' |
237 | | -would be specified as ``'ListNumber3'``. However, note that if you are using |
238 | | -a localized version of Word, the style ID may be derived from the English |
239 | | -style name and may not correspond so neatly to its style name in the Word UI. |
| 238 | +The style is specified using its style name, 'List Bullet' in this example. |
| 239 | +Generally, the style name is exactly as it appears in the Word user interface |
| 240 | +(UI). |
240 | 241 |
|
241 | 242 |
|
242 | 243 | Applying bold and italic |
@@ -324,8 +325,4 @@ the same result as the lines above:: |
324 | 325 | run = paragraph.add_run('text with emphasis.') |
325 | 326 | run.style = 'Emphasis' |
326 | 327 |
|
327 | | -As with a paragraph style, the style ID is formed by removing the spaces in |
328 | | -the name as it appears in the Word UI. So the style 'Subtle Emphasis' would |
329 | | -be specified as ``'SubtleEmphasis'``. Note that if you are using |
330 | | -a localized version of Word, the style ID may be derived from the English |
331 | | -style name and may not correspond to its style name in the Word UI. |
| 328 | +As with a paragraph style, the style name is as it appears in the Word UI. |