Kaydet (Commit) df0aab7f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Fix exporting pivot tables to xls esp wrt exporting duplicate data fields.

üst be76f5d7
...@@ -30,13 +30,14 @@ ...@@ -30,13 +30,14 @@
#define __SC_DPUTIL_HXX__ #define __SC_DPUTIL_HXX__
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "scdllapi.h"
class ScDPUtil class ScDPUtil
{ {
public: public:
static bool isDuplicateDimension(const rtl::OUString& rName); static bool isDuplicateDimension(const rtl::OUString& rName);
static rtl::OUString getSourceDimensionName(const rtl::OUString& rName); SC_DLLPUBLIC static rtl::OUString getSourceDimensionName(const rtl::OUString& rName);
static rtl::OUString createDuplicateDimensionName(const rtl::OUString& rOriginal, size_t nDupCount); static rtl::OUString createDuplicateDimensionName(const rtl::OUString& rOriginal, size_t nDupCount);
}; };
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "fapihelper.hxx" #include "fapihelper.hxx"
#include "xestring.hxx" #include "xestring.hxx"
#include "xelink.hxx" #include "xelink.hxx"
#include "dputil.hxx"
using namespace ::oox; using namespace ::oox;
...@@ -1294,7 +1295,7 @@ XclExpPivotTable::XclExpPivotTable( const XclExpRoot& rRoot, const ScDPObject& r ...@@ -1294,7 +1295,7 @@ XclExpPivotTable::XclExpPivotTable( const XclExpRoot& rRoot, const ScDPObject& r
maFieldList.AppendNewRecord( new XclExpPTField( *this, nFieldIdx ) ); maFieldList.AppendNewRecord( new XclExpPTField( *this, nFieldIdx ) );
boost::ptr_vector<ScDPSaveDimension>::const_iterator iter; boost::ptr_vector<ScDPSaveDimension>::const_iterator iter;
const boost::ptr_vector<ScDPSaveDimension>& rDimList = pSaveData->GetDimensions(); const ScDPSaveData::DimsType& rDimList = pSaveData->GetDimensions();
/* 2) First process all data dimensions, they are needed for extended /* 2) First process all data dimensions, they are needed for extended
settings of row/column/page fields (sorting/auto show). */ settings of row/column/page fields (sorting/auto show). */
...@@ -1524,8 +1525,8 @@ XclExpPTField* XclExpPivotTable::GetFieldAcc( const ScDPSaveDimension& rSaveDim ...@@ -1524,8 +1525,8 @@ XclExpPTField* XclExpPivotTable::GetFieldAcc( const ScDPSaveDimension& rSaveDim
return &maDataOrientField; return &maDataOrientField;
// a real dimension // a real dimension
String aFieldName( rSaveDim.GetName() ); rtl::OUString aFieldName = ScDPUtil::getSourceDimensionName(rSaveDim.GetName());
return aFieldName.Len() ? GetFieldAcc( aFieldName ) : 0; return aFieldName.isEmpty() ? NULL : GetFieldAcc(aFieldName);
} }
// fill data -------------------------------------------------------------- // fill data --------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment