Giter Site home page Giter Site logo

modulexcite / tabularasa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eskat0n/tabularasa

0.0 1.0 0.0 14.77 MB

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

Home Page: https://nuget.org/packages/TabulaRasa

License: GNU Lesser General Public License v3.0

C# 100.00%

tabularasa's Introduction

##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());
    }
}

tabularasa's People

Contributors

eskat0n avatar gizatulinvitaliy avatar hazzik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.