{"id":15785168,"url":"https://github.com/msdn-whiteknight/htmldocumentfactory","last_synced_at":"2025-06-24T06:33:00.903Z","repository":{"id":104375289,"uuid":"134078846","full_name":"MSDN-WhiteKnight/HtmlDocumentFactory","owner":"MSDN-WhiteKnight","description":"Helper library to assist in HTML creation with WinForms HtmlDocument class","archived":false,"fork":false,"pushed_at":"2018-05-19T17:50:42.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T20:34:43.726Z","etag":null,"topics":["csharp","csharp-library","dotnet","html","html-generation","winforms"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MSDN-WhiteKnight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T16:26:32.000Z","updated_at":"2020-01-30T01:16:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"595366e3-02ea-4223-bf43-ae942e528f86","html_url":"https://github.com/MSDN-WhiteKnight/HtmlDocumentFactory","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MSDN-WhiteKnight/HtmlDocumentFactory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSDN-WhiteKnight%2FHtmlDocumentFactory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSDN-WhiteKnight%2FHtmlDocumentFactory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSDN-WhiteKnight%2FHtmlDocumentFactory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSDN-WhiteKnight%2FHtmlDocumentFactory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MSDN-WhiteKnight","download_url":"https://codeload.github.com/MSDN-WhiteKnight/HtmlDocumentFactory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSDN-WhiteKnight%2FHtmlDocumentFactory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261620509,"owners_count":23185533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","csharp-library","dotnet","html","html-generation","winforms"],"created_at":"2024-10-04T20:21:22.205Z","updated_at":"2025-06-24T06:33:00.857Z","avatar_url":"https://github.com/MSDN-WhiteKnight.png","language":"C#","readme":"# HtmlDocumentFactory\n\nWindows Forms framework has a nice `HtmlDocument` class for HTML manupulation. However, it can only work with documents from `WebBrowser` control, and there's no public constructor to create new `HtmlDocument` instance from scratch. This library attempts to fix this problem. It consists of a single static class `HtmlLib.HtmlDocumentFactory` that provides helper methods for creating and destroying HTML documents and converting them to strings.\n\n[Download binaries](https://yadi.sk/d/lPk5bGov3WCXsD)\n\n**Usage**\n\nAdd reference to *HtmlDocumentFactory.dll* and import namespace with `using HtmlLib;` clause.\n\nCreate a new instance of HtmlDocument:\n\n    HtmlDocument htmldoc = HtmlDocumentFactory.CreateHtmlDocument();\n\nModify document's content like you wish:\n\n    HtmlElement el = htmldoc.CreateElement(\"div\");\n    el.InnerText = \"Hello, world!\";\n    el.Style = \"color: red\";\n    htmldoc.Body.AppendChild(el);\n\nCopy resulting HTML to string object:\n\n    textBox1.Text = HtmlDocumentFactory.HtmlDocumentToString(htmldoc);\n    \nFree unmanaged resources when you no longer need the document:\n\n    HtmlDocumentFactory.ReleaseHtmlDocument(htmldoc);\n    \nIf you need to create HtmlDocument based on existing HTML content, pass a string into CreateHtmlDocument method: \n\n    string html = \"\u003cp\u003eHello, world!\u003c/p\u003e\";\n    HtmlDocument htmldoc = HtmlDocumentFactory.CreateHtmlDocument(html);\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsdn-whiteknight%2Fhtmldocumentfactory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsdn-whiteknight%2Fhtmldocumentfactory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsdn-whiteknight%2Fhtmldocumentfactory/lists"}