{"id":20983697,"url":"https://github.com/andersnm/excelnumberformat","last_synced_at":"2025-04-13T02:23:24.720Z","repository":{"id":54451107,"uuid":"96682073","full_name":"andersnm/ExcelNumberFormat","owner":"andersnm","description":"Parse and render Excel number format strings","archived":false,"fork":false,"pushed_at":"2024-07-26T12:05:13.000Z","size":111,"stargazers_count":87,"open_issues_count":13,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T04:11:52.527Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andersnm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-09T12:12:43.000Z","updated_at":"2025-02-14T07:43:56.000Z","dependencies_parsed_at":"2024-11-19T05:53:23.343Z","dependency_job_id":"2db37476-090e-45ae-b965-3a5fa4b5b013","html_url":"https://github.com/andersnm/ExcelNumberFormat","commit_stats":{"total_commits":37,"total_committers":6,"mean_commits":6.166666666666667,"dds":0.3513513513513513,"last_synced_commit":"38c6a71919ad3895e3ba61d7a888012670d26303"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersnm%2FExcelNumberFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersnm%2FExcelNumberFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersnm%2FExcelNumberFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andersnm%2FExcelNumberFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andersnm","download_url":"https://codeload.github.com/andersnm/ExcelNumberFormat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248655017,"owners_count":21140411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T05:49:49.043Z","updated_at":"2025-04-13T02:23:24.690Z","avatar_url":"https://github.com/andersnm.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"ExcelNumberFormat\n=================\n\n.NET library to parse ECMA-376 number format strings and format values like Excel and other spreadsheet softwares.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/pg23vtba9wjr138f?svg=true)](https://ci.appveyor.com/project/andersnm/excelnumberformat)\n\n## Install via NuGet\n\nIf you want to include ExcelNumberFormat in your project, you can [install it directly from NuGet](https://www.nuget.org/packages/ExcelNumberFormat)\n\nTo install ExcelNumberFormat, run the following command in the Package Manager Console\n\n```\nPM\u003e Install-Package ExcelNumberFormat\n```\n\n## Usage\n\n```C#\nvar format = new NumberFormat(\"#.##\");\nConsole.WriteLine(format.Format(1234.56, CultureInfo.InvariantCulture));\n```\n\n## Features\n\n- Parses and formats most custom number formats as expected: decimal, percent, thousands, exponential, fraction, currency, date/time, duration, text.\n- Supports multiple sections with conditions.\n- Formats values with relevant constants from CultureInfo.\n- Supports DateTime, TimeSpan and numeric values for date and duration formats.\n- Supports both 1900- and 1904-based numeric datetimes (Excel on Mac uses 1904-based dates).\n- Targets net20 and netstandard1.0 for max compatibility.\n\n## Formatting .NET types\n\nThe `Format()` method takes a value of type `object` as parameter. Internally, the value is cast or converted to a specific .NET type depending on the kind of number format:\n\nFormat Kind | Example | .NET type|Conversion strategy\n-|-|-|-\nNumber   | 0.00      |double|Convert.ToDouble()\nFraction | 0/0       |double|Convert.ToDouble()\nExponent | \\#0.0E+0  |double|Convert.ToDouble()\nDate/Time| hh\\:mm    |DateTime|ExcelDateTime.TryConvert()\nDuration | \\[hh\\]\\:mm|TimeSpan|Cast or TimeSpan.FromDays()\nGeneral  | General   |(any)|CompatibleConvert.ToString()\nText     | ;;;\"Text: \"@|string|Convert.ToString()\n\nIn case of errors, `Format()` returns the value from `CompatibleConvert.ToString()`.\n\n`CompatibleConvert.ToString()` formats floats and doubles with explicit precision, or falls back to `Convert.ToString()` for any other types.\n`ExcelDateTime.TryConvert()` uses DateTimes as is, or converts numeric values to a DateTime with adjustments for legacy Excel behaviors.\n\n## TODO/notes\n\n- 'General' is formatted with `.ToString()` instead of Excel conventions.\n- No errors: Invalid format strings and incompatible input values are formatted with `.ToString()`.\n- No color information.\n- Variable width space is returned as regular space.\n- Repeat-to-fill characters are printed once, not repeated.\n- No alignment hinting.\n- No date conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersnm%2Fexcelnumberformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandersnm%2Fexcelnumberformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandersnm%2Fexcelnumberformat/lists"}