-
-
Notifications
You must be signed in to change notification settings - Fork 408
Closed
Description
Excel Type
- XLSX
- XLSM
- CSV
- OTHER
MiniExcel Version
1.35.0
Description
Saving with long sheet names (over 31 chars) causes Excel to show a 'We found a problem with some content...' message
Test Case
[Fact]
public void TestIssue693() {
var config = new OpenXmlConfiguration {
DynamicColumns = new DynamicExcelColumn[] {
new DynamicExcelColumn("id"){Ignore=true},
new DynamicExcelColumn("name"){Index=1,Width=10},
new DynamicExcelColumn("createdate"){Index=0,Format="yyyy-MM-dd",Width=15},
new DynamicExcelColumn("point"){Index=2,Name="Account Point"},
}
};
var path = PathHelper.GetTempPath();
var json = JsonConvert.SerializeObject(new[] { new { id = 1, name = "Jack", createdate = new DateTime(2022, 04, 12), point = 123.456 } }, Formatting.Indented);
var value = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(json);
// vvvvvvvvvvvvvvvvvvvvvvvvv
MiniExcel.SaveAs(path, value, sheetName: "Some Really Looooooooooong Sheet Name", configuration: config);
// ^^^^^^^^^^^^^^^^^^^^^^^^^
var rows = MiniExcel.Query(path, false).ToList();
Assert.Equal("createdate", rows[0].A);
Assert.Equal(new DateTime(2022, 04, 12), rows[1].A);
Assert.Equal("name", rows[0].B);
Assert.Equal("Jack", rows[1].B);
Assert.Equal("Account Point", rows[0].C);
Assert.Equal(123.456, rows[1].C);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels