NanoXLSX.Reader 3.0.0-rc.2
Loading...
Searching...
No Matches
Extensions/WorkbookReader.cs
1/*
2 * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3 * Copyright Raphael Stoeckli © 2025
4 * This library is licensed under the MIT License.
5 * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6 */
7
8using System.IO;
9using System.Threading.Tasks;
11using NanoXLSX.Registry;
12
14{
18 public static class WorkbookReader
19 {
20 static WorkbookReader()
21 {
22 PlugInLoader.Initialize();
23 }
24
32 public static Workbook Load(string filename, ReaderOptions options = null)
33 {
34 using (XlsxReader reader = new XlsxReader(filename, options))
35 {
36 reader.Read();
37 return reader.Workbook;
38 }
39 }
40
48 public static Workbook Load(Stream stream, ReaderOptions options = null)
49 {
50 using (XlsxReader reader = new XlsxReader(stream, options))
51 {
52 reader.Read();
53 return reader.Workbook;
54 }
55 }
56
64 public static async Task<Workbook> LoadAsync(string filename, ReaderOptions options = null)
65 {
66 using (XlsxReader reader = new XlsxReader(filename, options))
67 {
68 await reader.ReadAsync();
69 return reader.Workbook;
70 }
71 }
72
80 public static async Task<Workbook> LoadAsync(Stream stream, ReaderOptions options = null)
81 {
82 using (XlsxReader reader = new XlsxReader(stream, options))
83 {
84 await reader.ReadAsync();
85 return reader.Workbook;
86 }
87 }
88 }
89}
static Workbook Load(Stream stream, ReaderOptions options=null)
Loads a workbook from a stream.
static Workbook Load(string filename, ReaderOptions options=null)
Loads a workbook from a file.
static async Task< Workbook > LoadAsync(string filename, ReaderOptions options=null)
Loads a workbook from a file asynchronously.
static async Task< Workbook > LoadAsync(Stream stream, ReaderOptions options=null)
Loads a workbook from a stream asynchronously.
Class representing a reader to decompile XLSX files.
Definition XlsxReader.cs:28
async Task ReadAsync()
Reads the XLSX file from a file path or a file stream asynchronously.
void Read()
Reads the XLSX file from a file path or a file stream.
Definition XlsxReader.cs:75
Workbook Workbook
Gets the read workbook.
Definition XlsxReader.cs:40
The reader options define global rules, applied when loading a worksheet. The options are mainly to o...