Skip to content

Conditional formatting getting lost while copying sheets... #2488

Description

@ykgw-shashikumar

EPPlus usage

Commercial use (I have a commercial license)

Environment

Windows 11, Ubuntu 16

Epplus version

7.1.2, 7.5.0, 8.6.0, Latest also tested with

Spreadsheet application

Excel from "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"

Description

Hi EPPlus Team,

We are writing to report a bug related to conditional formatting (CF) being lost when copying worksheets using the Worksheets.Copy() API.

PROBLEM SUMMARY
When a workbook containing multiple sheets is opened and Worksheets.Copy() is called to duplicate a sheet, the conditional formatting on the DIP_SWITCH_SETTINGS sheet is lost in the copied sheet. The same operation works correctly on other sheets in the same workbook.
Additional Info:

  1. When the template has only 1 sheet(DIP_SWITCH_SETTINGS), then in the final report the conditional formatting is maintained.
  2. Similar bug was raised earlier . Conditional formatting not getting copied with Copy funciton · Issue #2381 · EPPlusSoftware/EPPlus

CODE TO REPRODUCE
for (int i = 1; i <= copyCount; i++)
{
package.Workbook.Worksheets.Copy(
sourceSheet.Name, $"{sheetName}_{i}");
}

We have a production release nearing and this is a blocking issue for us. We would greatly appreciate a patch release or workaround guidance at the earliest.

Please find the template file and the copied output file attached for your reference.

Thank you for your time and support.

Output_EPPlus.xlsx
template.xlsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions