# Strata.Excel.Core This provides a library for Strata standard ClosedXML Excel documents [![build](https://github.com/stratadecision/excel.core/actions/workflows/build.yaml/badge.svg)](https://github.com/stratadecision/excel.core/actions/workflows/build.yaml) [![SonarQube](https://img.shields.io/badge/SonarQube-Strata.excel.core-004880?logo=sonarqube)](https://sonarqube.sdt.local/dashboard?id=Strata.excel.core) [![Strata.Excel.Core](https://img.shields.io/badge/nuget-Strata.Excel.Core-004880?logo=nuget&logoColor=004880)](https://proget.ops.stratanetwork.net/feeds/nuget/Strata.Excel.Core/versions?HidePrerelease=True) [![Strata.Excel.TestUtilities](https://img.shields.io/badge/nuget-Strata.Excel.TestUtilities-004880?logo=nuget&logoColor=004880)](https://proget.ops.stratanetwork.net/feeds/nuget/Strata.Excel.TestUtilities/versions?HidePrerelease=True) ## Branching and Versioning | branch | version format | example | | ---------- | --------------------- | --------------- | | main | #.#.# | 1.2.3 | | feature/\* | #.#+1.0-featureName.# | 1.3.0-newfeat.1 | | fix/\* | #.#.#+1-fixName.# | 1.2.4-bug.1 | See our [confluence page](https://confluence.sdt.local/display/DOP/Branching+and+Versioning) for more information ## Usage ### Build and Run ``` docker-compose up -d --build ``` - https://localhost:8443/index (swagger api) - https://localhost:8443/hangfire (hangfire dashboard) - http://localhost:8081 (redis commander) ### Extracting nuget package ``` docker create --name throwaway strataexcel-excel-core docker cp throwaway:/pack . docker rm throwaway ``` ### Cleanup ``` docker-compose down ``` # Helpful Features ### Adding a drop down list to a worksheet ClosedXML offers the functionality for adding drop down lists to columns with validation out of the box. However, that implementation has a data length limitation of a formula field. For lists longer than trivial selections this extension method can be used: ```csharp /// Drop down list items /// Name of hidden worksheet that holds data /// Sort items in ascending order CreateDataValidation(this IXLColumn column, IEnumerable items, string hiddenWorksheetName, bool orderItems = true) ``` ### Example usage ```csharp var workbook = new XLWorkbook(); var worksheet= wb.Worksheets.Add("Strata Data Worksheet"); // Illustrating a list longer than standard Data Validation can handle var dropDownListItems = new List(){"Department A", "Department B", "Department C", "Department D", "Department E", "Department F" "Department G", "Department H", "Department I", "Department J", "Department K", "Department L" "Department M", "Department N", "Department O", "Department P", "Department Q", "Department R"}; // Add drop down with list items to all cells in column 1 worksheet.Column(1).CreateDataValidation(dropDownListItems, "Name of Worksheet"); ``` ### Notes * Worksheets must have unique names in excel therefore an overload for worksheet name is provided. When adding more than one drop down to a single worksheet it will be necessary to ensure each worksheet has a unique name. * Data validation is implemented by adding a hidden worksheet to your workbook that contains all of the desired list items, validation is performed against the hidden worksheet's list.