
NanoXLSX.Formatting

NanoXLSX is a small .NET library written in C#, to create and read Microsoft Excel files in the XLSX format (Microsoft Excel 2007 or newer) in an easy and native way
The Formatting package is responsible to enable NanoXLSX for the handling of structured text within a text cell (inline formatting).
Currently supported:
- Adding text runs (paragraphs) by a Builder or manually
- Defining Font styles per run
- Adding phonetic information (important for East Asian languages)
- Reading and writing runs, phonetic information and inline Font styles
Project website: https://picoxlsx.rabanti.ch
See the Change Log for recent updates.
What's new in version 3.x
This is the first release if this package. It was set to v 3.x, to be consistent with the NanoXLSX v3 ecosystem
Road map
Planned features:
- Style builder for general cell styles
- Assistant for valid custom format codes
- Support for conditional cell formatting
Requirements
NanoXLSX.Formatting is not intended as standalone package. It requires NanoXLSX.Core, and is normally part of the meta-package NanoXLSX
You find all technical requirements in the main repository: NanoXLSX
General requirements
- .NET 4.5 or newer / .NET Standard
- NanoXLSX.Core as only dependency
Utility dependencies
The Test project and GitHub Actions may also require dependencies like unit testing frameworks or workflow steps. However, none of these dependencies are essential to build the library. They are just utilities. The test dependencies ensure efficient unit testing and code coverage. The GitHub Actions dependencies are used for the automatization of releases and API documentation
Installation
Using NuGet
By package Manager (PM):
Install-Package NanoXLSX.Formatting
By .NET CLI:
dotnet add package NanoXLSX.Formatting
Usage
Quick Start (manual)
#
Workbook workbook = new Workbook("sheet1");
FormattedText formattedText = new FormattedText();
Font strikeFont = new Font() { Strike = true };
formattedText.AddRun("strike", strikeFont);
formattedText.AddLineBreak();
Font boldFont = new Font() { Bold = true, Name = "Tahoma" };
formattedText.AddRun("bold", boldFont);
workbook.CurrentWorksheet.AddFormattedTextCell(formattedText, "A1");
Quick Start (builders)
#
Workbook workbook = new Workbook("sheet1");
InlineStyleBuilder inlineStyleBuilder = new InlineStyleBuilder()
.Color("FFAABBCC")
.Italic()
.Size(18);
FormattedTextBuilder builder = new FormattedTextBuilder();
builder.AddRun("朝日", inlineStyleBuilder.Build());
builder.AddPhoneticRun("あさひ", 0, 2);
builder.AddRun("Asahi", new Font() { VerticalAlign = Font.VerticalTextAlignValue.Superscript });
workbook.CurrentWorksheet.AddFormattedTextCell(builder.Build(), 0, 0);
Further References
License
NanoXLSX.Formatting is published under the MIT license.
The project / package is developed with as much compliance to this license as only possible. Please visit the main repository NanoXLSX for compliance a scan, provided by Fossa