Skip to content

Commit 7b5f2d8

Browse files
Update _index.md
1 parent e01480e commit 7b5f2d8

File tree

1 file changed

+6
-26
lines changed
  • content/english/python-net/document-options-and-settings/document-functionality-web-extensions

1 file changed

+6
-26
lines changed

content/english/python-net/document-options-and-settings/document-functionality-web-extensions/_index.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ pip install aspose-words
3434
3. Import the library in your Python script.
3535

3636
```python
37-
import aspose.words
37+
import aspose.words as aw
3838
```
3939

4040
## Creating a New Document
4141

4242
Let's start by creating a new document using Aspose.Words:
4343

4444
```python
45-
document = aspose.words.Document()
45+
document = aw.Document()
4646
```
4747

4848
## Adding Content to the Document
4949

5050
You can easily add content to the document using Aspose.Words:
5151

5252
```python
53-
builder = aspose.words.DocumentBuilder(document)
53+
builder = aw.DocumentBuilder(document)
5454
builder.writeln("Hello, world!")
5555
```
5656

@@ -61,28 +61,8 @@ Styling and formatting play a crucial role in document presentation. Aspose.Word
6161
```python
6262
font = builder.font
6363
font.bold = True
64-
font.size = aspose.words.Size(16)
65-
font.color = aspose.words.Color.from_argb(255, 0, 0, 0)
66-
```
67-
68-
## Inserting Web Extensions
69-
70-
To insert a web extension into the document, follow these steps:
71-
72-
1. Create the web extension using HTML, CSS, and JavaScript.
73-
2. Convert the web extension into a base64-encoded string.
74-
75-
```python
76-
extension_html = "<div>Your web extension content</div>"
77-
extension_base64 = aspose.words.Convert.to_base64_string(extension_html)
78-
```
79-
80-
3. Insert the web extension into the document:
81-
82-
```python
83-
extension_node = aspose.words.DrawingML.Inline(doc)
84-
extension_node.image_data.set_source(extension_base64)
85-
builder.insert_node(extension_node)
64+
font.size = aw.Size(16)
65+
font.color = aw.Color.from_argb(255, 0, 0, 0)
8666
```
8767

8868
## Interacting with Web Extensions
@@ -98,7 +78,7 @@ Web extensions can dynamically modify document content. For instance, you can us
9878
After incorporating web extensions and making necessary modifications, you can save the document using various formats supported by Aspose.Words:
9979

10080
```python
101-
document.save("output.docx", aspose.words.SaveFormat.DOCX)
81+
document.save("output.docx")
10282
```
10383

10484
## Tips for Performance Optimization

0 commit comments

Comments
 (0)