233
votes
3answers
100k views

How to use HTML Agility pack

How do I use the HTML Agility Pack? My XHTML document is not completely valid. That's why I wanted to use it. How do I use it in my project? My project is in C#.
116
votes
20answers
120k views

Convert HTML to PDF in .NET [closed]

I want to generate PDF by passing HTML contents to a function. I have made use of ItextSharp for this but it does not perform well when it encounters Table and the layout just gets messy. Is there ...
113
votes
0answers
60k views

Looking for C# HTML parser [duplicate]

Possible Duplicate: What is the best way to parse html in C#? I would like to extract the structure of the HTML document - so the tags are more important than the content. Ideally, it ...
73
votes
10answers
94k views

Using C# regular expressions to remove HTML tags

How do I use C# regular expression to replace/remove all HTML tags, including the angle brackets? Can someone please help me with the code?
55
votes
8answers
44k views

How can I strip HTML tags from a string in ASP.NET?

Using ASP.NET, how can I strip the HTML tags from a given string reliably (i.e. not using regex)? I am looking for something like PHP's strip_tags. Example: ...
41
votes
4answers
24k views

Escape text for HTML

How do i escape text for html use in C#? I want to do sample="<span>blah<span>" and have <span>blah<span> show up as plain text instead of blah only with the tags part ...
39
votes
12answers
57k views

Generating HTML email body in C#

Is there a better way to generate HTML email in C# (for sending via System.Net.Mail), than using a Stringbuilder to do the following: string userName = "John Doe"; StringBuilder mailBody = new ...
33
votes
15answers
40k views

How can I Convert HTML to Text in C#?

I'm looking for C# code to convert an HTML document to plain text. I'm not looking for simple tag stripping , but something that will output plain text with a reasonable preservation of the ...
33
votes
6answers
7k views

How do I print an HTML document from a web service?

I want to print HTML from a C# web service. The Web Browser control is overkill, and does not function well in a service environment, nor does it function well on a system with very tight security ...
29
votes
2answers
33k views

HTML Agility pack - parsing tables

I want to use the HTML agility pack to parse tables from complex web pages, but I am somehow lost in the object model. I looked at the link example, but did not find any table data this way. Can I use ...
28
votes
6answers
2k views

Is the Html Agility Pack still the best .NET HTML parser?

Html Agility Pack was given as the answer to a StackOverflow question some time ago, is it still the best option? What other options should be considered? Is there something more lightweight?
27
votes
8answers
11k views

How do I filter all HTML tags except a certain whitelist?

This is for .NET. IgnoreCase is set and MultiLine is NOT set. Usually I'm decent at regex, maybe I'm running low on caffeine... Users are allowed to enter HTML-encoded entities (<lt;, <amp;, ...
26
votes
7answers
39k views

Open Source HTML to PDF Renderer with Full CSS Support [closed]

I asked about getting iTextSharp to render a PDF from HTML and a CSS sheet before here but it seems like that may not be possible... So I guess I will have to try something else. Is there an open ...
26
votes
8answers
15k views

How can I use the button tag with ASP.NET?

I'd like to use the newer <button> tag in an ASP.NET website which, among other things, allows CSS-styled text and embedding a graphic inside the button. The asp:Button control renders as ...
25
votes
5answers
5k views

Is there a jQuery-like CSS/HTML selector that can be used in C#?

I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css ...

1 2 3 4 5 246
15 30 50 per page