Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapper.Put<T> overload method has bug #16

Closed
VAllens opened this issue Nov 13, 2017 · 4 comments
Closed

Mapper.Put<T> overload method has bug #16

VAllens opened this issue Nov 13, 2017 · 4 comments
Labels
Milestone

Comments

@VAllens
Copy link

VAllens commented Nov 13, 2017

throw System.ArgumentException: Sheet index (0) is out of range (no sheets).

/// <summary>
/// Put objects in the sheet with specified zero-based index.
/// </summary>
/// <typeparam name="T">Target object type</typeparam>
/// <param name="objects">The objects to save.</param>
/// <param name="sheetIndex">The sheet index, default is 0.</param>
/// <param name="overwrite"><c>true</c> to overwrite existing rows; otherwise append.</param>
public void Put<T>(IEnumerable<T> objects, int sheetIndex = 0, bool overwrite = true)
{
	if (Workbook == null) Workbook = new XSSFWorkbook();
	var sheet = Workbook.GetSheetAt(sheetIndex);
	Put(sheet, objects, overwrite);
}

The second line in the method needs to judge the NumberOfSheets property first.
When it‘s value is greater than 0, the GetSheetAt method is called, otherwise, the CreateSheet method is called.

@donnytian donnytian added this to the v3.1 milestone Nov 13, 2017
@donnytian donnytian added the bug label Nov 13, 2017
@donnytian
Copy link
Owner

Hi, thanks for your help. Please use another Put overload with sheetName until this is addressed in next release.

@VAllens
Copy link
Author

VAllens commented Nov 13, 2017

Okey, thanks so much. :)
Npoi.Mapper is a good tool component

@VAllens
Copy link
Author

VAllens commented Nov 13, 2017

I think you can not only continue to integrate and build in AppVeyor, but also publish it directly to NuGet server, without manual publish. :)

@donnytian
Copy link
Owner

Hi, it will be published in v3.1, may a few days later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants