summaryrefslogtreecommitdiff
path: root/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx')
-rw-r--r--sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
index 3c56be5d48bc..0d98e79d9a1e 100644
--- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
@@ -84,7 +84,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
{
AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument,
formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
- FormulaTemplate aTemplate(mDocument, mAddressDetails);
+ FormulaTemplate aTemplate(mDocument);
boost::scoped_ptr<DataRangeIterator> pIterator;
if (mGroupedBy == BY_COLUMN)
@@ -94,6 +94,9 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
aOutput.nextColumn();
+ // Use explicit sheet name in case the input and output are on different sheets.
+ bool b3DAddress = mInputRange.aStart.Tab() != mOutputAddress.Tab();
+
// Write column/row labels
for( ; pIterator->hasNext(); pIterator->next() )
{
@@ -128,7 +131,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
for(sal_Int32 i = 0; lclCalcDefinitions[i].aFormula != NULL; i++)
{
aTemplate.setTemplate(lclCalcDefinitions[i].aFormula);
- aTemplate.applyRange(strWildcardRange, pIterator->get());
+ aTemplate.applyRange(strWildcardRange, pIterator->get(), b3DAddress);
aOutput.writeFormula(aTemplate.getTemplate());
aOutput.nextRow();
}