These focused console projects demonstrate the public DRIT.Spreadsheet API for
creating, reading, editing, and saving spreadsheet files. Each example writes
generated files to the repository-level Out directory and does not require an
Excel installation or vendor fixture.
- .NET Framework 4.8 or .NET 8 SDK.
- The examples use the released
DRIT.SpreadsheetNuGet package. - PDF and image examples also require the compatible
DRIT.PdfandDRIT.Drawingpackages.
The examples target net48 and net8.0. Use the framework supported by your
application and the package assets available in your environment.
From this directory:
dotnet build .\GettingStarted\GettingStarted.csproj -f net8.0 --nologo
dotnet run --project .\GettingStarted\GettingStarted.csproj -f net8.0Package-mode execution requires the normal DRIT.Spreadsheet license. PDF execution additionally requires a valid DRIT.Pdf license; NuGet authentication does not grant a product license.
Build the complete example solution with:
dotnet build .\DRIT.Spreadsheet.Examples.sln -f net8.0 --nologoThe package references use the approved rolling 26.x policy. Record the exact resolved package versions when validating a release.
| Example | Demonstrates |
|---|---|
| GettingStarted | Create, format, save, reload, and inspect a workbook |
| Reading | Generate a workbook, load it, and read typed values |
| Writing | Write scalar and array data and merge cells |
| Preservation | Edit a reloaded workbook while preserving existing content |
| CellValues | Text, numbers, booleans, dates, and formulas |
| RangeOperations | Bulk values, copy, clear, and merge ranges |
| RowColumnOperations | Width, height, autofit, and grouping |
| WorksheetManagement | Rename, copy, add, and hide worksheets |
| Example | Demonstrates |
|---|---|
| Charts | Chart creation and chart types |
| Comments | Cell comments |
| ConditionalFormatting | Conditional formatting rules |
| Filter | Worksheet filtering |
| FormControls | Form controls |
| Formatting | Cell and range formatting |
| EcmaFormulas | Formula evaluation |
| FreezeSplit | Freeze panes and split views |
| Ole | Embedded OLE objects |
| Pictures | Pictures |
| Shapes | Drawing shapes |
| Sparklines | Sparklines |
| Vba | VBA project preservation |
| WorksheetView | Worksheet view settings |
| Example | Demonstrates |
|---|---|
| Tables | Create an Excel table and calculated column |
| AutoFilter | Apply a value filter and verify filtered rows |
| Sorting | Multi-key ascending and descending sort conditions |
| DataValidation | List and decimal validation rules |
| FindAndReplace | Workbook find and replace |
| Hyperlinks | External and internal hyperlinks |
| DefinedNames | Formula and range defined names |
| DataTableImportExport | Import and export DataTable values |
| CsvImportExport | CSV save, reload, quoting, and values |
| PivotTables | Pivot fields, calculation, and saved pivot package parts |
| Slicers | Pivot slicer configuration and saved slicer package parts |
| JsonImportExport | JSON record import and range export |
| MarkdownExport | Markdown table export with escaped pipes |
The Phase 2 examples use deterministic generated data and write their results
to Out. Pivot and slicer examples inspect the saved XLSX package because
these features are represented by related Open XML parts. The current source
loader does not hydrate saved slicers back into the worksheet slicer collection,
so the slicer example verifies configuration before save and the persisted
package parts after save.
| Example | Demonstrates |
|---|---|
| StylesAndThemes | Reusable cell styles, theme colors, and a custom workbook theme |
| RichText | Multiple formatted runs in one cell and reload |
| PageSetup | Landscape A4 layout, print scaling, headings, and gridlines |
| HeadersAndFooters | Odd/even/first-page sections and page fields |
| RightToLeftText | RTL worksheet view and cell text direction |
| UnitConversion | Point, pixel, centimeter, inch, and row-height conversion |
| ChartTypes | Bar, line, pie, and scatter charts |
| ChartFormatting | Chart titles, legends, axes, gridlines, and data labels |
| ChartSheets | Dedicated chartsheets with full-sheet charts |
| ShapeAnchoring | Cell-relative shape placement with pixel offsets and sizes |
Chart and chartsheet examples inspect saved XLSX chart parts in addition to checking the public chart model. The current print-area and print-title setters are not presented as persisted features because generated print defined names are not emitted by the current writer.
| Example | Demonstrates |
|---|---|
| DocumentProperties | Summary and custom document properties with package inspection |
| WorkbookProtection | Workbook structure protection and password hashing |
| WorksheetProtection | Worksheet protection flags and unlocked cells |
| WriteProtection | Read-only recommendation metadata |
| Encryption | ECMA-376 agile encryption, correct-password load, and wrong-password rejection |
| DigitalSignature | Create, list, and remove an XLSX digital signature |
| CustomXml | Add, select, edit, and persist a custom XML part |
| PdfExport | Export multiple worksheets to PDF and verify page count |
| ProgressAndCancellation | PDF page progress events and pre-cancelled export behavior |
Phase 4 examples use net8.0, except DigitalSignature and Vba, which run on
net48 because their signing and VBA paths are platform-gated in the current
stack. PDF examples require a valid DRIT.Pdf license. The document-properties writer currently persists the author and custom
property package parts, but title/subject/keywords/company and custom-property
type hydration are not asserted as XLSX reload behavior. Workbook protection
currently emits the protection element while the structure-lock state is
verified through the public in-memory model.
| Example | Demonstrates | Package status |
|---|---|---|
| HtmlImportExport | HTML table export and HTML table import | Local source only; pending the released package API |
| ImageExport | PNG page rendering with dimensions and file checks | Local source only; requires current DRIT.Drawing/image-export APIs |
| ThreadedComments | Authors, threaded replies, resolved comments, and XLSX reload | Local source only; pending the released package API |
| Scenarios | Scenario metadata, input cells, and XLSX reload | Local source only; pending the released package loader API |
The Phase 5 examples use APIs that may require a newer package release than the currently resolved 26.x version. Build those projects individually and treat unsupported APIs as package-compatibility issues rather than source-checkout requirements. Query tables, streaming load/save, fixed-width text, and other backlog items remain planned because there is no stable public authoring path for a deterministic console example.
In contains small checked-in input fixtures when an example needs one. Every
generated workbook is written below Out; the directory is safe to delete and
recreate.