fsprojects / ExcelProvider

This library is for the .NET platform implementing a Excel type provider.
http://fsprojects.github.io/ExcelProvider/
The Unlicense
141 stars 51 forks source link

Support Row.GetValue("column") and handle of out-of-range column indexes explicitly #27

Closed jayhill closed 8 years ago

jayhill commented 8 years ago

The goal is to support row.GetValue "header name" in the same way that row.GetValue columnIndex is currently supported.

I wasn't sure what should happen if an invalid header name was supplied. I wanted to be consistent with an invalid column index being supplied, but found no explicit handling or tests around that scenario. I did find that if a row index was out-of-range, null was returned. Based on this, I decided to:

  1. Fail explicitly when a negative column index is supplied,
  2. Return null when a positive column index is supplied, but it is outside the range of used columns,
  3. Fail explicitly when a column name (header) is supplied and it does not match an existing column header, and
  4. Implement column-header-lookup in a case-sensitive manner. If a header is not found, perform a case-insensitive key search, solely for the purpose of providing a more helpful message (Column "foo" was not found. Did you mean "Foo"?).

Added tests for each of these and updated "cells" doc.

dsyme commented 8 years ago

@JohnDoeKyrgyz @forki @luajalla - are you guys/gals ok good to process this, and update the nuget package (if it's accepted)? Thanks

forki commented 8 years ago

thanks. I released a new package.