-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Support ColumnIndex Attribute #142
Labels
Comments
shps951023
changed the title
Support ColumnIndex/Name/Ignore Attribute
Support ColumnIndex Attribute
Apr 2, 2021
public class Demo
{
public int MyProperty { get; set; } //index = 1
public int MyProperty2 { get; set; } //index = 3
public int MyProperty3 { get; set; } //index = 4
[ExcelColumnIndex("A")] // equal column index 0
public int MyProperty4 { get; set; }
[ExcelColumnIndex(2)]
public int MyProperty5 { get; set; } //index = 2
public int MyProperty6 { get; set; } //index = 5
} 但還在考慮這個功能實不實用,自己沒用過這功能,但其他框架有提供才列在Issue |
shps951023
added a commit
that referenced
this issue
Apr 9, 2021
- [New] Support Support ColumnIndex Attribute [#142](#142) & [#I3I3EB](https://gitee.com/dotnetchina/MiniExcel/issues/I3I3EB) - [Bug] Fix issue #157 : Special conditions will get the wrong worksheet name - [Update] issue #150 : SaveAs input IEnuerable<valuetype> should throw clear msg exception
shps951023
added a commit
that referenced
this issue
Apr 9, 2021
- [New] Support Support ColumnIndex Attribute [#142](#142) & [#I3I3EB](https://gitee.com/dotnetchina/MiniExcel/issues/I3I3EB) - [Bug] Fix issue #157 : Special conditions will get the wrong worksheet name - [Update] issue #150 : SaveAs input IEnuerable<valuetype> should throw clear msg exception
0.11.1 Excel Column Name/Index/Ignore Attributee.g input excel : public class ExcelAttributeDemo
{
[ExcelColumnName("Column1")]
public string Test1 { get; set; }
[ExcelColumnName("Column2")]
public string Test2 { get; set; }
[ExcelIgnore]
public string Test3 { get; set; }
[ExcelColumnIndex("I")] // system will convert "I" to 8 index
public string Test4 { get; set; }
public string Test5 { get; } //wihout set will ignore
public string Test6 { get; private set; } //un-public set will ignore
[ExcelColumnIndex(3)] // start with 0
public string Test7 { get; set; }
}
var rows = MiniExcel.Query<ExcelAttributeDemo>(path).ToList();
Assert.Equal("Column1", rows[0].Test1);
Assert.Equal("Column2", rows[0].Test2);
Assert.Null(rows[0].Test3);
Assert.Equal("Test7", rows[0].Test4);
Assert.Null(rows[0].Test5);
Assert.Null(rows[0].Test6);
Assert.Equal("Test4", rows[0].Test7); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: