Skip to content

Optimize setting the value of a cell if the merge state of the cell is known in advance #2303

New issue

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added 'IsInferiorMergedCellUserDefined' for prevent calculating it
  • Loading branch information
Artemy Gordon committed Feb 27, 2024
commit 13f289424c661ece4b6cdff4c1c1633ea5fd1995
7 changes: 7 additions & 0 deletions ClosedXML/Excel/Cells/XLCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ internal XLCell(XLWorksheet worksheet, XLSheetPoint point) : this(worksheet, poi

public XLAddress Address => new(Worksheet, _rowNumber, _columnNumber, false, false);

public bool? IsInferiorMergedCellUserDefined { get; set; }

internal XLSheetPoint SheetPoint => new(_rowNumber, _columnNumber);

#region Slice fields
Expand Down Expand Up @@ -1997,6 +1999,11 @@ static bool IsHorizontalBorderBlank(XLWorksheet sheet, int borderRow, int border

internal bool IsInferiorMergedCell()
{
if (this.IsInferiorMergedCellUserDefined.HasValue)
{
return this.IsInferiorMergedCellUserDefined.Value;
}

return this.IsMerged() && !this.Address.Equals(this.MergedRange().RangeAddress.FirstAddress);
}

Expand Down