Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atifaziz/xltableformat
XlTable format reader
https://github.com/atifaziz/xltableformat
Last synced: 15 days ago
JSON representation
XlTable format reader
- Host: GitHub
- URL: https://github.com/atifaziz/xltableformat
- Owner: atifaziz
- License: apache-2.0
- Created: 2014-04-30T21:19:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-02T08:41:27.000Z (over 10 years ago)
- Last Synced: 2024-10-05T00:07:52.906Z (about 1 month ago)
- Language: C#
- Size: 156 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING.txt
Awesome Lists containing this project
README
# XlTableFormat
The [XlTable format](https://github.com/atifaziz/XlTableFormat/wiki/XlTable:-Fast-Table-Format) is a fast table format when using [Dynamic Data Exchange (DDE)](http://en.wikipedia.org/wiki/Dynamic_Data_Exchange) to get data from Microsoft Excel. This project provides a single C# file called `XlTableFormat.cs` that adds the neccessary types and code to read and decode the XlTable format.
## Installing
There is a [NuGet package](https://www.nuget.org/packages/XlTableFormat.Source/) that embeds `XlTableFormat.cs` in a C# project.
There is no stand-alone class library version. If you need one, create a C# class library project, add the `XlTableFormat.Source` package from NuGet and declare the following types public:
public partial class XlTableFormat {}
public partial interface IXlTableDataFactory { }
public partial class XlTableDataFactory { }## Usage
The simplest way to read the XlTable format is to use ones of the following `XlTableFormat.Read` overloads, each of which takes the data as input (either as a byte array or as a stream) and lazily yields a sequence of decoded objects:
public static IEnumerable Read(byte[] data)
public static IEnumerable Read(Stream stream)The XlTable format defines the following data block types:
- Table
- Float
- String
- Bool
- Error
- Blank
- Int
- SkipThe type of each object in the sequence returned from the `Read` method is mapped from XlTable data blocks to C# and runtime types as follows:
- Table = array of `int` with two integers, the row and column count respectively
- Float = `double`
- String = `string`
- Bool = `bool`
- Error = [`ErrorWrapper`](http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.errorwrapper.aspx)
- Blank = `null`
- Int = `int`
- Skip = [`Missing.Value`](http://msdn.microsoft.com/en-us/library/system.reflection.missing.value.aspx)The first object returned in the sequence always defines the table dimensions as an array of two integers with the row count as the first integer and column count as the second. The remaining objects are sequential content of table as cells values.