Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{introducedin: 8.4}
{description}
{excerpt}Sets or returns whether Microsoft Excel will automatically refresh a PivotTable and the PivotTable cache when Excel opens the document.{excerpt}
{signature:C#}
 public boolean RefreshOnOpen{ get; set; }
{signature}{signature:vb.net}
Public Property RefreshOnOpen() As Boolean
{signature}
{example}{code:csharp|title=C#}

          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xlsx");
          Worksheet ws = wb.Worksheets[0];
          ws.PivotTables[0].PivotTableSettings.RefreshOnOpen = true;
        {code}
{code:vbnet|title=vb.net}

          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xlsx")
          Dim ws As Worksheet = wb.Worksheets(0)
          ws.PivotTables(0).PivotTableSettings.RefreshOnOpen = true;
        {code}

{example}
{remarks}
{{RefreshOnOpen}} is {{false}} by default.

When creating or modifying a PivotTable with ExcelWriter, make sure to set this property to see the changes. If this property is not set in code or in a template, the PivotTable will not reflect changes made with ExcelWriter code. 

Setting {{RefreshOnOpen}} is the same as going to _PivotTable Options_ > _Data_ and checking or unchecking _Refresh data when opening the file_. 
{remarks}