Skip to content

TabulaRasa is a .NET library which provides a fluent API for generating, changing and templating documents in OpenXML format.

License

Notifications You must be signed in to change notification settings

Eskat0n/TabulaRasa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##About TabulaRasa is .NET library which provides a fluent API for generating, changing and templating documents in OpenXML format.

##NuGet Install

Nuget Foxby

NuGet link https://nuget.org/packages/TabulaRasa

##Object Hierarchy

Hierarchy

##Examples

###1 Hello Word!

private static void Main()
{
    using (var docxDocument = new DocxDocument(SimpleTemplate.EmptyWordFile))
    {
        var builder = new DocxDocumentBuilder(docxDocument);
 
        builder.Tag(SimpleTemplate.ContentTagName,
                    x => x.Center.Paragraph(z => z.Bold.Text("Hello Word!")));


        File.WriteAllBytes(string.Format(@"D:\Word.docx"), docxDocument.ToArray());
    }
}

###2 Table and formatting

private static void Main()
{
    string customerName = "Jonh Smith";
    string orderNumber = "4";
    string itemName1 = "Pen";
    string itemSumm1 = "5 000";
    string itemName2 = "Laptop";
    string itemSumm2 = "6 342";
    string summ = "11 342";

    using (var docxDocument = new DocxDocument(SimpleTemplate.EmptyWordFile))
    {
        var builder = new DocxDocumentBuilder(docxDocument);
 
        builder.Tag(SimpleTemplate.ContentTagName,
                    x => x.Center.Paragraph(z => z.Bold.Text(string.Format("Offer №{0}", orderNumber)))
                          .Right.Paragraph(DateTime.Now.ToString("dd MMMM yyyy"))
                          .Left.Paragraph(string.Format("I, {0}, buy:", customerName))
                          .Table(t => t.Column("Item", 70).Column("Price", 30),
                                 r => r.Row(itemName1, itemSumm1)
                                       .Row(itemName2, itemSumm2)
                                       .Row(w => w.Right.Bold.Text("Total:"), 
                                 w => w.Center.Bold.Underlined.Text(summ))));
 

        File.WriteAllBytes(string.Format(@"D:\Word.docx"), docxDocument.ToArray());
    }
}

About

TabulaRasa is a .NET library which provides a fluent API for generating, changing and templating documents in OpenXML format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •