Skip to content

Commit d12b6d7

Browse files
Updates
1 parent c87132d commit d12b6d7

File tree

2 files changed

+39
-103
lines changed
  • content/english/net/working-with-html-documents

2 files changed

+39
-103
lines changed

content/english/net/working-with-html-documents/_index.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@
22
title: Working with HTML Documents
33
linktitle: Working with HTML Documents
44
second_title: Aspose.Slides .NET HTML manipulation API
5-
description:
5+
description: Discover the world of HTML document creation and manipulation in .NET with Aspose.HTML. From creating simple documents to in-depth editing.
66
type: docs
77
weight: 23
88
url: /net/working-with-html-documents/
99
---
1010

11-
## Working with HTML Documents Tutorials
11+
Are you a web developer looking to dive into the realm of HTML document creation and manipulation using .NET? Look no further! In this comprehensive tutorial series, we'll explore the power of Aspose.HTML and how it can simplify your tasks. Whether you're a newbie or an experienced developer, you'll find valuable insights and practical tips to boost your skills.
12+
13+
## Introduction
14+
15+
HTML documents are the backbone of the web, and being able to create and manipulate them effectively is a crucial skill for any web developer. In this tutorial series, we'll focus on working with HTML documents in the .NET environment, and we'll do it with the help of Aspose.HTML, a powerful and versatile library.
16+
17+
### Getting Started
18+
19+
Before we dive into the specifics of creating and editing HTML documents in .NET, let's take a moment to understand what Aspose.HTML is and why it's a valuable tool in your development arsenal. Aspose.HTML is a feature-rich library that provides developers with the tools they need to work with HTML documents seamlessly. Whether you're building a web application, generating reports, or simply need to manipulate HTML content programmatically, Aspose.HTML has got you covered.
20+
1221
### [Creating a Document in .NET with Aspose.HTML](./creating-a-document-dotnet-aspose-html/)
13-
Learn how to create HTML documents in .NET using Aspose.HTML, from scratch or from URLs. A comprehensive tutorial for web developers.
22+
23+
The first step in our journey is learning how to create HTML documents from scratch or from URLs using Aspose.HTML. We'll guide you through the process, ensuring that even beginners can follow along. By the end of this section, you'll have the skills to generate HTML documents effortlessly.
24+
1425
### [Creating a Simple Document in .NET with Aspose.HTML](./creating-a-simple-document-dotnet-aspose-html/)
15-
Learn to work with HTML documents in .NET using Aspose.HTML. Create, manipulate, and convert HTML effortlessly. Get started today!
16-
### [Editing a Document in .NET with Aspose.HTML](./editing-a-document-dotnet-aspose-html/)
26+
27+
Once you've grasped the basics, we'll delve deeper into the creation process. In this section, you'll learn how to create simple HTML documents using Aspose.HTML, and we'll explore various features that allow for easy manipulation. Whether you're building a webpage, generating content, or converting data to HTML, this tutorial will equip you with the necessary knowledge.
28+
29+
### [Editing a Document in .NET with Aspose.HTML](./editing-a-document-dotnet-aspose-html/)
30+
31+
Now, let's take your skills to the next level. Editing HTML documents is a common task for web developers, and Aspose.HTML simplifies this process significantly. In this section, we'll cover document creation, manipulation, and styling. You'll discover how to enhance the appearance and functionality of your web content, making it engaging and user-friendly.

content/english/net/working-with-html-documents/editing-a-document-dotnet-aspose-html/_index.md

Lines changed: 19 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Editing a Document in .NET with Aspose.HTML
33
linktitle: Editing a Document in .NET with Aspose.HTML
44
second_title: Aspose.Slides .NET HTML manipulation API
5-
description:
5+
description: Learn how to work with HTML documents in .NET using Aspose.HTML. This comprehensive tutorial covers document creation, manipulation, and styling. Get started now!
66
type: docs
77
weight: 12
88
url: /net/working-with-html-documents/editing-a-document-dotnet-aspose-html/
@@ -14,11 +14,11 @@ Welcome to our tutorial on using Aspose.HTML for .NET, a powerful tool for handl
1414

1515
Before we dive into the code examples, make sure you have the following prerequisites in place:
1616

17-
1. **Visual Studio**: You'll need Visual Studio installed on your machine to follow along with the examples.
17+
1. Visual Studio: You'll need Visual Studio installed on your machine to follow along with the examples.
1818

19-
2. **Aspose.HTML for .NET**: You should have Aspose.HTML for .NET library installed. You can download it from [here](https://releases.aspose.com/html/net/).
19+
2. Aspose.HTML for .NET: You should have Aspose.HTML for .NET library installed. You can download it from [here](https://releases.aspose.com/html/net/).
2020

21-
3. **A Basic Understanding of C#**: Familiarity with C# programming will be helpful, but even if you're new to C#, you can still follow along and learn.
21+
3. A Basic Understanding of C#: Familiarity with C# programming will be helpful, but even if you're new to C#, you can still follow along and learn.
2222

2323
## Importing Necessary Namespaces
2424

@@ -54,7 +54,7 @@ static void EditDocumentTree()
5454
}
5555
```
5656

57-
**Explanation:**
57+
### Explanation:
5858

5959
1. We start by creating a new HTML document using `Aspose.Html.HTMLDocument()`.
6060

@@ -88,7 +88,7 @@ static void EditDocumentTreeWithAppendRemoveChild()
8888
}
8989
```
9090

91-
**Explanation:**
91+
### Explanation:
9292

9393
1. We create an HTML document with existing elements, including a `<p>` and a `<div>`.
9494

@@ -118,7 +118,7 @@ static void EditHtml()
118118
}
119119
```
120120

121-
**Explanation:**
121+
### Explanation:
122122

123123
1. We create a new HTML document.
124124

@@ -151,7 +151,7 @@ static void EditElementStyle()
151151
}
152152
```
153153

154-
**Explanation:**
154+
### Explanation:
155155

156156
1. We create an HTML document with embedded CSS that sets the color of `<p>` elements to red.
157157

@@ -184,7 +184,7 @@ static void EditElementStyleUsingAttribute()
184184
}
185185
```
186186

187-
**Explanation:**
187+
### Explanation:
188188

189189
1. We create an HTML document with embedded CSS that sets the color of `<p>` elements to red.
190190

@@ -210,98 +210,19 @@ If you have any questions or need further assistance, don't hesitate to visit th
210210

211211
## Frequently Asked Questions (FAQs)
212212

213-
1. **What is Aspose.HTML for .NET?**
214-
- Aspose.HTML for .NET is a powerful library for working with HTML documents in .NET applications.
213+
### What is Aspose.HTML for .NET?
214+
Aspose.HTML for .NET is a powerful library for working with HTML documents in .NET applications.
215215

216-
2. **Where can I download Aspose.HTML for .NET?**
217-
- You can download Aspose.HTML for .NET from [here](https://releases.aspose.com/html/net/).
216+
### Where can I download Aspose.HTML for .NET?
217+
You can download Aspose.HTML for .NET from [here](https://releases.aspose.com/html/net/).
218218

219-
3. **Is there a free trial available?**
220-
- Yes, you can get a free trial of Aspose.HTML from [here](https://releases.aspose.com/).
219+
### Is there a free trial available?
220+
Yes, you can get a free trial of Aspose.HTML from [here](https://releases.aspose.com/).
221221

222-
4. **How can I purchase a license?**
223-
- To purchase a license, visit [this link](https://purchase.aspose.com/buy).
222+
### How can I purchase a license?
223+
To purchase a license, visit [this link](https://purchase.aspose.com/buy).
224224

225-
5. **Do I need prior experience with HTML to use Aspose.HTML for .NET?**
226-
- While HTML knowledge is helpful, you can use Aspose.HTML for .NET even if you're not an HTML expert.
225+
### Do I need prior experience with HTML to use Aspose.HTML for .NET?
226+
While HTML knowledge is helpful, you can use Aspose.HTML for .NET even if you're not an HTML expert.
227227

228-
## Search Engine Optimized Description
229228

230-
Learn how to work with HTML documents in .NET using Aspose.HTML. This comprehensive tutorial covers document creation, manipulation, and styling. Get started now!
231-
232-
**Note:** Please make sure to check the latest documentation and updates from Aspose.HTML as the library may have evolved since the last knowledge update in September 2021.
233-
## Complete Source Code
234-
```csharp
235-
236-
static void EditDocumentTree()
237-
{
238-
using (var document = new Aspose.Html.HTMLDocument())
239-
{
240-
var body = document.Body;
241-
// Create paragraph element
242-
var p = (Aspose.Html.HTMLParagraphElement)document.CreateElement("p");
243-
// Set custom attribute
244-
p.SetAttribute("id", "my-paragraph");
245-
// Create text node
246-
var text = document.CreateTextNode("my first paragraph");
247-
// Attach text to the paragraph
248-
p.AppendChild(text);
249-
// Attach paragraph to the document body
250-
body.AppendChild(p);
251-
}
252-
}
253-
static void EditDocumentTreeWithAppendRemoveChild()
254-
{
255-
using (var document = new Aspose.Html.HTMLDocument("<p>paragraph</p><div>some element to remove</div>", "about:blank"))
256-
{
257-
var body = document.Body;
258-
// Get "div" element
259-
var div = (Aspose.Html.HTMLDivElement)body.GetElementsByTagName("div").First();
260-
// Remove found element
261-
body.RemoveChild(div);
262-
}
263-
}
264-
static void EditHtml()
265-
{
266-
using (var document = new Aspose.Html.HTMLDocument())
267-
{
268-
// Get body element
269-
var body = document.Body;
270-
// Set content of the body element
271-
body.InnerHTML = "<p>paragraph</p>";
272-
// Move to the first child
273-
var node = body.FirstChild;
274-
System.Console.WriteLine(node.LocalName);
275-
}
276-
}
277-
static void EditElementStyle()
278-
{
279-
using (var document = new Aspose.Html.HTMLDocument("<style>p { color: red; }</style><p>my first paragraph</p>", "about:blank"))
280-
{
281-
// Get the element to inspect
282-
var element = document.GetElementsByTagName("p")[0];
283-
// Get the CSS view object
284-
var view = (Aspose.Html.Dom.Css.IViewCSS)document.Context.Window;
285-
// Get the computed style of the element
286-
var declaration = view.GetComputedStyle(element);
287-
// Get "color" property value
288-
System.Console.WriteLine(declaration.Color); // rgb(255, 0, 0)
289-
}
290-
}
291-
static void EditElementStyleUsingAttribute()
292-
{
293-
using (var document = new Aspose.Html.HTMLDocument("<style>p { color: red; }</style><p>my first paragraph</p>", "about:blank"))
294-
{
295-
// Get the element to edit
296-
var element = (Aspose.Html.HTMLElement)document.GetElementsByTagName("p")[0];
297-
// Get the CSS view object
298-
var view = (Aspose.Html.Dom.Css.IViewCSS)document.Context.Window;
299-
// Get the computed style of the element
300-
var declaration = view.GetComputedStyle(element);
301-
// Set green color
302-
element.Style.Color = "green";
303-
// Get "color" property value
304-
System.Console.WriteLine(declaration.Color); // rgb(0, 128, 0)
305-
}
306-
}
307-
```

0 commit comments

Comments
 (0)