Bodoconsult.Web.Html
1.0.11
dotnet add package Bodoconsult.Web.Html --version 1.0.11
NuGet\Install-Package Bodoconsult.Web.Html -Version 1.0.11
<PackageReference Include="Bodoconsult.Web.Html" Version="1.0.11" />
<PackageVersion Include="Bodoconsult.Web.Html" Version="1.0.11" />
<PackageReference Include="Bodoconsult.Web.Html" />
paket add Bodoconsult.Web.Html --version 1.0.11
#r "nuget: Bodoconsult.Web.Html, 1.0.11"
#:package Bodoconsult.Web.Html@1.0.11
#addin nuget:?package=Bodoconsult.Web.Html&version=1.0.11
#tool nuget:?package=Bodoconsult.Web.Html&version=1.0.11
Bodoconsult.Web.Html
What does the library
The Bodoconsult.Web.Html library containes tools
to create an advanced HTML table with more formatting (Table class width Sytlesheet class)
to create simple markdown documents from code (MarkdownBuilder class)
How to use the library
The source code contain NUnit test classes, the following source code is extracted from. The samples below show the most helpful use cases for the library.
Create a simple HTML table
var table = new Table();
table.Attributes.Add("class","cssTableClass");
// Header
var headerrow = new TableRow(table);
headerrow.Attributes.Add("class","cssHeaderRowClass" );
ITableCell cell = new TableHeaderCell(headerrow) { Text = "Header1" };
cell.Attributes.Add("class", "cssHeaderCellClass" );
cell = new TableHeaderCell(headerrow) { Text = "Header2" };
// Content
var contentrow = new TableRow(table);
cell = new TableCell(contentrow) { Text = "Content1" };
cell.Attributes.Add("class", "cssContentCellClass" );
cell = new TableCell(contentrow) { Text = "Content2" };
// Act
var s = table.RenderIt();
Create an advanced HTML table
var styleSheet = new Stylesheet();
styleSheet.CssClassTable("cssTableClass");
styleSheet.CssClassTrHeader("cssHeaderRowClass");
styleSheet.CssClassTh("cssHeaderCellClass");
styleSheet.CssClassTrBody("cssBodyRowClass");
styleSheet.CssClassTd("cssContentCellClass");
// Arrange
var table = new Table {Stylesheet = styleSheet};
// Header
var headerrow = new TableRow(table);
ITableCell cell = new TableHeaderCell(headerrow) { Text = "Header1" };
cell = new TableHeaderCell(headerrow) { Text = "Header2" };
// Content
var contentrow = new TableRow(table);
cell = new TableCell(contentrow) { Text = "Content1" };
cell = new TableCell(contentrow) { Text = "Content2" };
// Act
var s = table.RenderIt();
## Create a HTML table from a System.Data.DataTable
var dt = TestHelper.GetDataTable("LineChart.xml");
var erg = TableFormatter.FormatAsHtml(dt, true);
MarkdownBuilder: create simple markdown files from code
[Test]
public void Save_ValidContent_FileSaved()
{
var path = Path.Combine(Path.GetTempPath(), "test.md");
if (File.Exists(path))
{
File.Delete(path);
}
Assert.That(File.Exists(path), Is.False);
// Arrange
var builder = new MarkdownBuilder();
const string content = "Test blubb blubb";
// Act
builder.AddHeadline1("Headline 1");
builder.AddParagraph(content);
builder.AddRawMarkdown("## SubHeadline\r\n\r\nBlubb blabb blubb\r\n\r\n");
builder.AddParagraph(content);
builder.AddParagraph(content);
builder.AddHeadline1("Headline 2");
builder.AddParagraph(content);
builder.AddParagraph(content);
builder.AddParagraph(content);
builder.Save(path);
// Assert
Assert.That(File.Exists(path));
if (File.Exists(path))
{
File.Delete(path);
}
}
About us
Bodoconsult (http://www.bodoconsult.de) is a Munich based software company from Germany.
Robert Leisner is senior software developer at Bodoconsult. See his profile on http://www.bodoconsult.de/Curriculum_vitae_Robert_Leisner.pdf.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Test migration to .NET 8 and added README.MD