Skip to content

Named Range: the cell's DataValidation got changed from "List" to "AnyValue" after calling InsertTable #2259

Open
@justcode123-cloud

Description

@justcode123-cloud

Read and complete the full issue template

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

Version of ClosedXML

0.102.2

What is the current behavior?
Previously defined DataValidation gets changed after calling the following method:
ClosedXML.Excel.IXLCell :
IXLTable InsertTable(IEnumerable data, string tableName, bool createTable);

AllowedValues = "List" ===> this is being changed to "AnyValue"
Value = [my named range] ===> this is being changed to ""
Ranges = {Entities!H2:H1048576} ===> this is being changed to {Entities!H3:H3}

What is the expected behavior?

Previously defined DataValidation should be kept as is, after calling the InsertTable method.
AllowedValues should continue to be "List"
Value should continue to be [my named range]
Ranges should continue to be {Entities!H2:H1048576}

Is this a regression from the previous version?
Unknown

Reproducibility

DataValidation got changed from "List" to "AnyValue" (see debugging screen prints attached)

before calling InsertTable:
AllowedValues = List,
Ranges = {Entities!H2:H1048576},
Values = rngEntityTypes (named Range)

after calling InsertTable:
AllowedValues = AnyValue,
Ranges = {Entities!H2:H3},
Values = ""

Code to reproduce problem:

public void Main()
{
var table = worksheet.Cell(startCell.Address).InsertTable(contentList, "MyTable", false);
}
  • I attached a sample spreadsheet. (You can drag files on to this issue)
    before calling "InsertTable":
    before InsertTable
    after calling "InsertTable":
    after insertTable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions