Nedev.FileConverters.XlsToXlsx
0.1.0
dotnet add package Nedev.FileConverters.XlsToXlsx --version 0.1.0
NuGet\Install-Package Nedev.FileConverters.XlsToXlsx -Version 0.1.0
<PackageReference Include="Nedev.FileConverters.XlsToXlsx" Version="0.1.0" />
<PackageVersion Include="Nedev.FileConverters.XlsToXlsx" Version="0.1.0" />
<PackageReference Include="Nedev.FileConverters.XlsToXlsx" />
paket add Nedev.FileConverters.XlsToXlsx --version 0.1.0
#r "nuget: Nedev.FileConverters.XlsToXlsx, 0.1.0"
#:package Nedev.FileConverters.XlsToXlsx@0.1.0
#addin nuget:?package=Nedev.FileConverters.XlsToXlsx&version=0.1.0
#tool nuget:?package=Nedev.FileConverters.XlsToXlsx&version=0.1.0
Nedev.FileConverters.XlsToXlsx
Nedev.FileConverters.XlsToXlsx is a standalone, lightweight, and fast .NET library designed to convert legacy Microsoft Excel files (.xls / BIFF8 format) into the modern OpenXML format (.xlsx). It performs this conversion entirely in memory and does not require Microsoft Office or Excel Interop to be installed.
π Features
β Supported
- OLE Compound File Parsing: Fully implements FAT and DIFAT chain parsing to reliably read even large and highly-fragmented
.xlsfiles. - Cell Data: Extracts formulas, numbers, strings (including Shared String Table), booleans, and errors.
- Formatting & Styles: Converts fonts (size, color, bold, italic), cell fills/patterns, borders, and alignment.
- Worksheet Layout: Preserves row heights, column widths, fixed/frozen panes, and hidden rows/cols.
- Merged Cells: Accurately maps merged cell ranges.
Overlapping or nested ranges are now filtered in parser order: the first merge is kept and any later range that intersects it is discarded. This avoids Excel warnings while preventing a single huge union cell from appearing in the output. - Hyperlinks: Preserves cell hyperlinks (external URLs, local files, and email addresses).
- Comments/Notes: Extracts basic cell notes/comments.
- Data Validation: Retains basic data validation rules (dropdowns, number constraints).
- VBA Macros: Preserves existing VBA macros by extracting the raw
vbaProject.binfrom the legacy file and embedding it into a macro-enabled.xlsmcompatible structure. - Page Setup: Keeps print margins, page orientation, paper size, and fit-to-page scaling.
- Pivot Tables: Converts pivot table structure (fields, layout, data source range); output can be refreshed in Excel.
- AutoFilter: Preserves filter range (from _FilterDatabase name) and filter column indices; writes
<autoFilter ref="...">with<filterColumn>in XLSX. - Worksheet / Workbook Protection: Preserves sheet/workbook protection flags and 16βbit password hashes; writes corresponding
sheetProtection/workbookProtectionso Excel still prompts for the original password. - Document Properties: Reads OLE SummaryInformation/DocumentSummaryInformation and writes matching
docProps/core.xmlanddocProps/app.xml(title, subject, author, company, timestamps, etc). - External Workbook Links: Converts EXTERNSHEET/EXTERNBOOK into OOXML
externalLinksparts and updates 3D formula refs to[n]Sheet!A1form.
β οΈ Partially Supported (WIP)
- Formulas: A custom formula decompiler supports over 170+ standard Excel functions. Shared formulas (
SHAREDFMLA) and array formulas (ARRAY) are supported. - Charts: Can detect and convert basic chart types (bar, line, pie, etc.), but advanced 3D properties and secondary axes are not yet fully mapped.
- Images & Drawings: Basic image extraction is supported, but complex Microsoft Office Drawing (Escher) containers are partially parsed.
- Conditional Formatting: Detection is supported, but styling rules (like Color Scales and Data Bars) currently use fallback styles instead of the exact embedded binary properties.
β Not Yet Supported
- (none so far β all previously listed features have been implemented in this round, except for advanced edge-cases not covered in README.)
π¦ Installation
(To be added when published to NuGet)
dotnet add package Nedev.FileConverters.XlsToXlsx
# core infrastructure required by all converters
dotnet add package Nedev.FileConverters.Core
π» Usage
This repository contains two deliverables:
Nedev.FileConverters.XlsToXlsxβ the core library (DLL) implementing the converter.Nedev.FileConverters.XlsToXlsx.Cliβ a small console application that wraps the library and provides a commandβline interface. This CLI is what can be packaged as a global tool.
Running the CLI locally
# build and run inside repo
cd src\Nedev.FileConverters.XlsToXlsx
dotnet run -- -i input.xls -o output.xlsx
The CLI tool understands the following options:
-i|--input <path>β input file or directory (required)-o|--output <file>β output file path (only for single-file conversion)--dump-colorsβ inspect an XLS palette/fonts instead of converting--versionβ display the tool version and exit--helpβ show usage information
If the input path is a directory, all *.xls files will be batch-converted.
Example (file)
xls2xlsx -i C:\old.xls -o C:\new.xlsx
Example (folder)
xls2xlsx -i C:\legacy-files
Inspect colors
xls2xlsx -i C:\workbook.xls --dump-colors
as a global tool
After publishing to NuGet the CLI package can be installed globally:
dotnet tool install --global Nedev.FileConverters.XlsToXlsx.Cli
# then run via its command name:
xls2xlsx -i file.xls
The conversion API is still available for library consumers; see the example below.
- Core integration β since this package now implements
IFileConverterfromNedev.FileConverters.Core, you can invoke conversion via the sharedConverter.Convert(...)helper and discover converters automatically.
Converting a .xls file to .xlsx takes just a few lines of code. you may use the core helper as shown below:
using System;
using Nedev.FileConverters;
class Program
{
static void Main()
{
string inputFilePath = @"C:\path\to\your\legacy_file.xls";
string outputFilePath = @"C:\path\to\your\converted_file.xlsx";
try
{
// the Core library will locate the Xls -> Xlsx converter automatically
using var inStream = File.OpenRead(inputFilePath);
using var converted = Converter.Convert(inStream, "xls", "xlsx");
using var outStream = File.Create(outputFilePath);
converted.CopyTo(outStream);
Console.WriteLine("Conversion completed successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to convert: {ex.Message}");
}
}
}
π οΈ Architecture
The conversion process involves standardizing BIFF8 records into an intermediate domain model (Workbooks, Worksheets, Cells, Styles), which is then serialized into standard OpenXML components containing xl/worksheets/sheet1.xml, xl/styles.xml, etc.
OleCompoundFile: Manages parsing of the Microsoft Compound File Binary stream.BiffRecord/XlsParser: Breaks down binary streams into logically decipherable records.FormulaDecompiler: Transforms RPN (Reverse Polish Notation) parsed formula bytes (Ptg) back into text.XlsxGenerator: Produces compliant Open XML (.xlsx) ZIP archives from the domain model.
π License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Nedev.FileConverters.Core (>= 0.1.0)
-
net8.0
- Nedev.FileConverters.Core (>= 0.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 114 | 3/6/2026 |