Open Source .NET Library for Composing Excel Spreadsheets
Compose Excel spreadsheets based on a tree of nested components like the HTML DOM
BookFx is an open source C# API for creating Microsoft Excel Worksheets using components like HTML DOM elements. The API uses tree of nodes, which renders to a XLSX file. This method allows nodes to be implemented as a resulable components. Furthermore, hierarchy of nodes is convenient for applying styles. BookFx helps you define the structure of the workbook in a better way and takes the pain out of the calculating sizes and addresses of ranges.
Every sheet in the workbook can contatin one root box at upper left corner, other boxes are strecthed to fit in the composite boxes. Boxes are placed in the form of RowBox, ColBox and StackBox.
Getting Started with BookFx
The recommended way to install BookFx is from Nuget, Please use the following command for fasters installation.
Install BookFx from NuGet
Create Excel Like HTML DOM - C#
BookFx allows C# .NET developers to create new excel worksheets. You can create a blank workbook using Make.Book().ToBytes() method. Its an effective method for creating workbooks without any complexity. You can even insert text while creating the workbook by using Make.Value("Hi, World!").ToSheet().ToBook().ToBytes() method.
Span & Merge in Excel using C#
The API also allows spanning and merging rows and columns in excel. It uses ValueBox methods SpanTows and SpanCols and their combination Span to define the number of spanned cells. The Merger method is used to merge cells, but BookFx merges ranges of a ValueBox automatically if the box has a value or a formula.
Using Values and Formulas in Excel using C#
BookFx also allows using values and formulas in your excel worksheets. Using the ValueBox you can create values and formulas. It can be created using Make.Value method. To use the formula the value should beging with '=' operator like Make.Value("=SUM(RC:RC)").