Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Wiki Markup
{introducedin: 8.4

...

Description

Excerpt

Changes the data source of the PivotTable to a new Area.

Signature
C#C#
}
{description}

{excerpt}
Changes the data source of the {{PivotTable}} to a new {{[Area]}}.
{excerpt}

{signature:C#}
public void ChangeDataSource(Area newArea)

Signature
{signature}

{signature:vb.net
vb.net
}
Public Sub ChangeDataSource(ByVal newArea As Area)

Parameters
{signature}

{parameters}

{param:newArea}
An {{[Area]}} object representing the new data source in the same workbook.

{param}



{example}
{code:csharp|title=C#}
Area newArea = worksheet.CreateArea("A1:C7");
pivotTable.ChangeDataSource(newArea);
{code}

{code:vbnet|title=vb.net
}
Dim newArea As Area = worksheet.CreateArea("A1:C7")
pivotTable.ChangeDataSource(newArea)
Param
newAreanewArea

An Area object representing the new data source in the same workbook.

Example
Code Block
csharpcsharp
titleC#
Code Block
vbnetvbnettitle
Exceptions
Exception
ArgumentExceptionArgumentException

An exception of type ArgumentException will be thrown if:

  • A null reference is passed in as a parameter instead of a valid Area object
  • The new data source is not in the same workbook
  • Not every cell in the first row of the new area contains a value for the column name
  • The area for the new data source only has one row (PivotTables require at least two)
    {code}
    {example}
    
    
    {exceptions}
    
    {exception:ArgumentException}
    
    An exception of type {{ArgumentException}} will be thrown if:
    * A {{null}} reference is passed in as a parameter instead of a valid {{[Area]}} object
    * The new data source is not in the same workbook
    * Not every cell in the first row of the new area contains a value for the column name
    * The area for the new data source only has one row (PivotTables require at least two)
    
    {exception}