Column names are not CASE-SENSITIVE when it should be? 'The header row contains more than one field name 'x'.
See original GitHub issueRead and complete the full issue template
Do not randomly delete sections. They are here for a reason.
Do you want to request a feature or report a bug?
- Bug
- Feature
- Question
Did you test against the latest CI build?
- [X ] Yes
- No
If you answered No
, please test with the latest development build first.
Version of ClosedXML
e.g. 0.95.4
What is the current behavior?
Colum with: ‘Geheel getal’ and ‘geheel getal’ gives a conflict:
“The header row contains more than one field name ‘Geheel getal’.”
Both entries should be working as unique columns, it should be ‘case-sensitive’. Am I missing something?
STACKTRACE:
at ClosedXML.Excel.XLTable.RescanFieldNames()
at ClosedXML.Excel.XLTable.get_FieldNames()
at ClosedXML.Excel.XLWorkbook.<>c__DisplayClass348_0.<GenerateSharedStringTablePartContent>b__2(IXLTable t)
at ClosedXML.Excel.EnumerableExtensions.ForEach[T](IEnumerable1 source, Action
1 action)
at ClosedXML.Excel.XLWorkbook.<>c__DisplayClass348_0.<GenerateSharedStringTablePartContent>b__0(IXLWorksheet w)
at ClosedXML.Excel.EnumerableExtensions.ForEach[T](IEnumerable1 source, Action
1 action)
at ClosedXML.Excel.XLWorkbook.GenerateSharedStringTablePartContent(SharedStringTablePart sharedStringTablePart, SaveContext context)
at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document, SaveOptions options)
at ClosedXML.Excel.XLWorkbook.CreatePackage(Stream stream, Boolean newStream, SpreadsheetDocumentType spreadsheetDocumentType, SaveOptions options)
at ClosedXML.Excel.XLWorkbook.SaveAs(Stream stream, SaveOptions options)
at ClosedXML.Excel.XLWorkbook.SaveAs(Stream stream, Boolean validate, Boolean evaluateFormulae)
at ClosedXML.Excel.XLWorkbook.SaveAs(Stream stream)
at VMA_Server.Application.Services.ExcelService.CreateManagingFile[T](IEnumerable`1 list, String sheetName) in D:\Development\VMA\VMA-Server\VMA-Server\VMA-Server.Application\Services\ExcelService.cs:line 31
What is the expected behavior or new feature?
‘Geheel getal’ and ‘geheel getal’ should be working fine. They have to be used case-sensitive instead of ignore cases
Is this a regression from the previous version?
Didnt work for 0.95.3 aswell.
Reproducibility
This is an important section. Read it carefully. Failure to do so will cause a ‘RTFM’ comment.
Without a code sample, it is unlikely that your issue will get attention. Don’t be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.
Code to reproduce problem:
public class ExcelService : IExcelService
{
public byte[] CreateManagingFile<T>(string sheetName) where T : IManagingExcel {
try
{
using var workbook = new XLWorkbook();
var worksheet = workbook.Worksheets.Add(sheetName);
worksheet.Cell(1, 1).Value = "Geheel getal";
worksheet.Cell(1, 2).Value = "geheel getal";
var firstCell = worksheet.FirstCellUsed();
var lastCell = worksheet.LastCellUsed();
worksheet.Range(firstCell.Address, lastCell.Address).CreateTable();
worksheet.Columns().AdjustToContents();
using var stream = new MemoryStream();
workbook.SaveAs(stream);
return stream.ToArray();
}catch(Exception e)
{
return null;
}
}
}
- Spreadsheet is not generated, because of the error. On workbook.SaveAs the error gets thrown
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Yes, then I suggest you create unique column names.
If seems like it does not work in Excel either… I guess it is impossible to be using case-sensitive data in Excel. What would u suggest? Appending something behind the values?