diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 387b3ba14895..91ece5695a86 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1805,7 +1805,7 @@ Resource RID_GLOBSTR }; String STR_PIVOT_FIRSTROWEMPTYERR { - Text [ en-US ] = "The field name cannot be empty. Check the first row of data source to make sure there are no empty cells." ; + Text [ en-US ] = "One or more fields appear to have an empty name. Check the first row of the data source to ensure there are no empty cells." ; }; String STR_PIVOT_ONLYONEROWERR { diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 64febde3a460..1ff482773d6e 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2166,6 +2166,8 @@ void ScCellShell::ExecuteDataPilotDialog() } else // create new table { + sal_uLong nSrcErrorId = 0; + // select database range or data pTabViewShell->GetDBData( true, SC_DB_OLD ); ScMarkData& rMark = GetViewData()->GetMarkData(); @@ -2241,8 +2243,12 @@ void ScCellShell::ExecuteDataPilotDialog() OUString aName = pTypeDlg->GetSelectedNamedRange(); ScSheetSourceDesc aShtDesc(pDoc); aShtDesc.SetRangeName(aName); - pNewDPObject.reset(new ScDPObject(pDoc)); - pNewDPObject->SetSheetDesc(aShtDesc); + nSrcErrorId = aShtDesc.CheckSourceRange(); + if (!nSrcErrorId) + { + pNewDPObject.reset(new ScDPObject(pDoc)); + pNewDPObject->SetSheetDesc(aShtDesc); + } } else // selection { @@ -2279,8 +2285,12 @@ void ScCellShell::ExecuteDataPilotDialog() { ScSheetSourceDesc aShtDesc(pDoc); aShtDesc.SetSourceRange(aRange); - pNewDPObject.reset(new ScDPObject(pDoc)); - pNewDPObject->SetSheetDesc( aShtDesc ); + nSrcErrorId = aShtDesc.CheckSourceRange(); + if (!nSrcErrorId) + { + pNewDPObject.reset(new ScDPObject(pDoc)); + pNewDPObject->SetSheetDesc( aShtDesc ); + } // output below source data if ( aRange.aEnd.Row()+2 <= MAXROW - 4 ) @@ -2292,6 +2302,14 @@ void ScCellShell::ExecuteDataPilotDialog() } } + if (nSrcErrorId) + { + // Error occurred during data creation. Launch an error and bail out. + InfoBox aBox(pTabViewShell->GetDialogParent(), ScGlobal::GetRscString(nSrcErrorId)); + aBox.Execute(); + return; + } + if ( pNewDPObject ) pNewDPObject->SetOutRange( aDestPos ); }