Page 1 of 1

Error when opening xlsx workbook containing a Pivot

Posted: Tue Jul 10, 2018 1:58 pm
by GenasysCarl
Hi

After populating and saving a xlsx workbook, containing a Pivot, we get the below error when opening the saved file in excel.

Removed Part: /xl/pivotTables/pivotTable1.xml part with XML error. (PivotTable view) No attribute name may appear more than once in the same start tag or empty element tag. Line 12, column 215.

After then viewing the XML files, I found that the <pivotTableDefinition> tag in the xl\pivotTables\pivotTable1.xml file contains the "count" attributes twice.

I fixed this by preventing the "count" attribute to be added twice in the xpgPXML.pas => TXpgWriteXML.AddAttribute method

Code: Select all

procedure TXpgWriteXML.AddAttribute(const AName, AValue: AxUCString);
var
  sAtt : string;
begin
  sAtt:= FAttributes.pStart;
  if (sAtt.Contains('count=') and (AName = 'count')) then
    Exit;
//.
//.
//.
Not the best solution but it works for now. It is relatively safe (being case sensitive) as the only other attributes I could see which ends with "count" are part of another word e.g. "rowPageCount"

Re: Error when opening xlsx workbook containing a Pivot

Posted: Thu Jul 12, 2018 12:42 pm
by larsa
Hello

This is probably a symptom of some other error. Can you please send me an Excel file that causes this error?