# GrapeCity.Documents.Excel.IPivotTable.SubtotalLocation

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_IPivotTable_SubtotalLocation_" data-uid="GrapeCity.Documents.Excel.IPivotTable.SubtotalLocation*">SubtotalLocation Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_IPivotTable_SubtotalLocation_" data-uid="GrapeCity.Documents.Excel.IPivotTable.SubtotalLocation*"></a>
<h4 id="GrapeCity_Documents_Excel_IPivotTable_SubtotalLocation_GrapeCity_Documents_Excel_SubtotalLocationType_" data-uid="GrapeCity.Documents.Excel.IPivotTable.SubtotalLocation(GrapeCity.Documents.Excel.SubtotalLocationType)">SubtotalLocation(SubtotalLocationType)</h4>
<div class="markdown level1 summary"><p>Changes the subtotal location for all existing pivot fields.</p>
<p>
Changing the subtotal location has an immediate visual effect only for
fields in outline form, but the setting is also applied to fields in tabular
form.
</p><p>
If the row axis layout is <a class="xref" href="GrapeCity.Documents.Excel.LayoutRowType.html#GrapeCity_Documents_Excel_LayoutRowType_TabularRow">TabularRow</a>, the
<code>location</code> must be <a class="xref" href="GrapeCity.Documents.Excel.SubtotalLocationType.html#GrapeCity_Documents_Excel_SubtotalLocationType_Bottom">Bottom</a>.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void SubtotalLocation(SubtotalLocationType location)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub SubtotalLocation(location As SubtotalLocationType)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.SubtotalLocationType.html">SubtotalLocationType</a></td>
      <td><span class="parametername">location</span></td>
      <td><p>The subtotal location to apply to all existing pivot fields.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Excel_IPivotTable_SubtotalLocation_GrapeCity_Documents_Excel_SubtotalLocationType__examples">Examples</h5>
<pre><code class="lang-csharp">worksheet.Range["A1:B4"].Value = new object[,] {
    {"Category", "Amount"},
    {"Beverages", 100},
    {"Snacks", 200},
    {"Beverages", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"]);
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
pivotTable.SubtotalLocation(SubtotalLocationType.Bottom);</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></td>
      <td><p>If the row axis layout is <a class="xref" href="GrapeCity.Documents.Excel.LayoutRowType.html#GrapeCity_Documents_Excel_LayoutRowType_TabularRow">TabularRow</a> and <code class="paramref">location</code> is not <a class="xref" href="GrapeCity.Documents.Excel.SubtotalLocationType.html#GrapeCity_Documents_Excel_SubtotalLocationType_Bottom">Bottom</a>.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
