Skip to content

Commit db07657

Browse files
Update _index.md
1 parent a08b6c8 commit db07657

File tree

1 file changed

+23
-11
lines changed
  • content/english/python-net/word-automation/word-automation-made-easy

1 file changed

+23
-11
lines changed

content/english/python-net/word-automation/word-automation-made-easy/_index.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ type: docs
77
weight: 10
88
url: /python-net/word-automation/word-automation-made-easy/
99
---
10-
1110
## Introduction
1211

1312
In the fast-paced world of today, automating tasks has become essential to improve efficiency and productivity. One such task is Word Automation, where we can create, manipulate, and process Word documents programmatically. In this step-by-step tutorial, we will explore how to achieve Word Automation easily using Aspose.Words for Python, a powerful library that provides a wide range of features for word processing and document manipulation.
@@ -67,14 +66,27 @@ font.bold = True
6766
Tables are a crucial element in Word documents, and Aspose.Words makes it easy to work with them.
6867

6968
```python
70-
# Add a table to the document
71-
table = doc.get_child_nodes(aw.NodeType.TABLE, True).add()
72-
73-
# Add rows and cells to the table
74-
table.ensure_minimum()
75-
for row in table.rows:
76-
for cell in row.cells:
77-
cell.get_first_paragraph().get_runs().add("Cell Text")
69+
builder = aw.DocumentBuilder(doc=doc)
70+
table = builder.start_table()
71+
builder.insert_cell()
72+
builder.write('City')
73+
builder.insert_cell()
74+
builder.write('Country')
75+
builder.end_row()
76+
builder.insert_cell()
77+
builder.write('London')
78+
builder.insert_cell()
79+
builder.write('U.K.')
80+
builder.end_table()
81+
# Use the first row's "RowFormat" property to modify the formatting
82+
# of the contents of all cells in this row.
83+
row_format = table.first_row.row_format
84+
row_format.height = 25
85+
row_format.borders.get_by_border_type(aw.BorderType.BOTTOM).color = aspose.pydrawing.Color.red
86+
# Use the "CellFormat" property of the first cell in the last row to modify the formatting of that cell's contents.
87+
cell_format = table.last_row.first_cell.cell_format
88+
cell_format.width = 100
89+
cell_format.shading.background_pattern_color = aspose.pydrawing.Color.orange
7890
```
7991

8092
## Inserting Images and Shapes
@@ -107,7 +119,7 @@ Once we have finished working with the document, we can save it in different for
107119

108120
```python
109121
# Save the document to a file
110-
doc.save("output.docx", aw.SaveFormat.DOCX)
122+
doc.save("output.docx")
111123
```
112124

113125
## Advanced Word Automation Features
@@ -122,7 +134,7 @@ Besides creating and formatting documents, Aspose.Words can automate document pr
122134

123135
Word Automation with Aspose.Words for Python opens up a world of possibilities in document generation and manipulation. This tutorial has covered the basic steps to get you started, but there's so much more to explore. Embrace the power of Word Automation and streamline your document workflows with ease!
124136

125-
## FAQs
137+
## FAQ's
126138

127139
### Is Aspose.Words compatible with other platforms like Java or .NET?
128140
Yes, Aspose.Words is available for multiple platforms, including Java and .NET, allowing developers to use it in their preferred programming language.

0 commit comments

Comments
 (0)