We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1.35.0
Saving with long sheet names (over 31 chars) causes Excel to show a 'We found a problem with some content...' message
[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); }
The text was updated successfully, but these errors were encountered:
Excel worksheets do not support names longer than 31 chars, Please use less than 31 chars.
Sorry, something went wrong.
Hi @jiaguangli ,
When I have time, I think I'll create a PR to auto truncate the sheet name. It would be a better user experience than Excel complaining 🙂
We can throw an exception in the code,and it's probably not a good idea to cover up the error.
No branches or pull requests
Excel Type
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
The text was updated successfully, but these errors were encountered: