Show column/row grand totals only when at least one column/row field exists.
Otherwise the grand total would be just a duplicate of the data field area.
This commit is contained in:
parent
778a6993b9
commit
1fb5aea16f
2 changed files with 13 additions and 12 deletions
|
@ -1662,9 +1662,7 @@ void Test::testPivotTableFilters()
|
|||
{ 0, 0 },
|
||||
{ "Data", 0 },
|
||||
{ "Sum - Val1", "8" },
|
||||
{ "Sum - Val2", "80" },
|
||||
{ "Total Sum - Val1", "8" },
|
||||
{ "Total Sum - Val2", "80" }
|
||||
{ "Sum - Val2", "80" }
|
||||
};
|
||||
|
||||
bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (unfiltered)");
|
||||
|
@ -1676,7 +1674,7 @@ void Test::testPivotTableFilters()
|
|||
ScAddress aFormulaAddr = aOutRange.aEnd;
|
||||
aFormulaAddr.IncRow(2);
|
||||
m_pDoc->SetString(aFormulaAddr.Col(), aFormulaAddr.Row(), aFormulaAddr.Tab(),
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=B8")));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=B6")));
|
||||
double fTest = m_pDoc->GetValue(aFormulaAddr);
|
||||
CPPUNIT_ASSERT_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", fTest == 80.0);
|
||||
|
||||
|
@ -1698,9 +1696,7 @@ void Test::testPivotTableFilters()
|
|||
{ 0, 0 },
|
||||
{ "Data", 0 },
|
||||
{ "Sum - Val1", "4" },
|
||||
{ "Sum - Val2", "40" },
|
||||
{ "Total Sum - Val1", "4" },
|
||||
{ "Total Sum - Val2", "40" }
|
||||
{ "Sum - Val2", "40" }
|
||||
};
|
||||
|
||||
bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by page)");
|
||||
|
@ -1730,9 +1726,7 @@ void Test::testPivotTableFilters()
|
|||
{ 0, 0 },
|
||||
{ "Data", 0 },
|
||||
{ "Sum - Val1", "2" },
|
||||
{ "Sum - Val2", "20" },
|
||||
{ "Total Sum - Val1", "2" },
|
||||
{ "Total Sum - Val2", "20" }
|
||||
{ "Sum - Val2", "20" }
|
||||
};
|
||||
|
||||
bSuccess = checkDPTableOutput<2>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output (filtered by query)");
|
||||
|
|
|
@ -863,8 +863,15 @@ void ScDPSource::CreateRes_Impl()
|
|||
aInitState.AddMember( nPageDims[i], GetMemberId( nPageDims[i], pDim->GetSelectedData() ) );
|
||||
}
|
||||
|
||||
pColResRoot = new ScDPResultMember( pResData, bColumnGrand );
|
||||
pRowResRoot = new ScDPResultMember( pResData, bRowGrand );
|
||||
// Show grand total columns only when the option is set *and* there is at
|
||||
// least one column field. Same for the grand total rows.
|
||||
sal_uInt16 nDataLayoutOrient = GetDataLayoutOrientation();
|
||||
long nColDimCount2 = nColDimCount - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_COLUMN ? 1 : 0);
|
||||
long nRowDimCount2 = nRowDimCount - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_ROW ? 1 : 0);
|
||||
bool bShowColGrand = bColumnGrand && nColDimCount2 > 0;
|
||||
bool bShowRowGrand = bRowGrand && nRowDimCount2 > 0;
|
||||
pColResRoot = new ScDPResultMember(pResData, bShowColGrand);
|
||||
pRowResRoot = new ScDPResultMember(pResData, bShowRowGrand);
|
||||
|
||||
FillCalcInfo(false, aInfo, bHasAutoShow);
|
||||
long nColLevelCount = aInfo.aColLevels.size();
|
||||
|
|
Loading…
Reference in a new issue