Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 12 additions & 2 deletions main/SS/Formula/OperandClassTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,21 @@ private void TransformNode(ParseNode node, byte desiredOperandClass,
// Note - the tAttrSum token (node.getToken()) is a base
// token so does not need to have its operand class set
}
if (token is ValueOperatorPtg || token is ControlPtg
|| token is MemFuncPtg
if (token is MemFuncPtg
|| token is MemAreaPtg
|| token is UnionPtg
|| token is IntersectionPtg)
{
// Reference-type operators: children preserve the desired operand class.
// This ensures that Area3DPtg tokens inside union/intersection expressions
// (e.g. multiple print areas) keep CLASS_REF when used in a named range context.
for (int i = 0; i < children.Length; i++)
{
TransformNode(children[i], desiredOperandClass, callerForceArrayFlag);
}
return;
}
if (token is ValueOperatorPtg || token is ControlPtg)
{
// Value Operator Ptgs and Control are base Tokens, so Token will be unchanged
// but any child nodes are processed according To desiredOperandClass and callerForceArrayFlag
Expand Down
22 changes: 22 additions & 0 deletions testcases/main/SS/UserModel/BaseTestWorkbook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,28 @@ public void TestPrintArea()
workbook.Close();
}

[Test]
public void TestMultiplePrintArea()
{
IWorkbook workbook = _testDataProvider.CreateWorkbook();
ISheet sheet1 = workbook.CreateSheet("Sheet1");
String sheetName1 = sheet1.SheetName;

// Set multiple print areas with comma-delimited references
String reference = "$A$1:$C$5,$E$6:$F$9";
workbook.SetPrintArea(0, reference);
String retrievedPrintArea = workbook.GetPrintArea(0);
ClassicAssert.IsNotNull(retrievedPrintArea, "Multiple print area should not be null");
// Both areas should be present with the sheet name prefix
ClassicAssert.IsTrue(retrievedPrintArea.Contains("$A$1:$C$5"), "First area should be present");
ClassicAssert.IsTrue(retrievedPrintArea.Contains("$E$6:$F$9"), "Second area should be present");
ClassicAssert.IsTrue(retrievedPrintArea.Contains(sheetName1), "Sheet name should be present");

workbook.RemovePrintArea(0);
ClassicAssert.IsNull(workbook.GetPrintArea(0));
workbook.Close();
}

[Test]
public void TestGetSetActiveSheet()
{
Expand Down
Loading