Am trying to get the total number of rows in a pivot. The following code only gives coordinatescrather than the actual number of rows:
<pre class=“lang-cs prettyprint prettyprinted” style=“margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-size: 13px; width: auto; max-height: 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, “Lucida Console”, “Liberation Mono”, “DejaVu Sans Mono”, “Bitstream Vera Sans Mono”, “Courier New”, monospace, sans-serif; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal;”><code style=“margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, “Lucida Console”, “Liberation Mono”, “DejaVu Sans Mono”, “Bitstream Vera Sans Mono”, “Courier New”, monospace, sans-serif; white-space: inherit;”>var book =newWorkbook(dir +“sample.xlsx”); var sheet = book.Worksheets[0]; var pivot = sheet.PivotTables[0];
// DataBodyRange returns CellArea that represents range between the header row & insert row var dataBodyRange = pivot.DataBodyRange; Console.WriteLine(dataBodyRange); // TableRange1 returns complete Pivot Table area except page fields var tableRange1 = pivot.TableRange1; Console.WriteLine(tableRange1); // TableRange2 returns complete Pivot Table area including page fields var tableRange2 = pivot.TableRange2; Console.WriteLine(tableRange2); // ColumnRange returns range that represents the column area of the Pivot Table var columnRange = pivot.ColumnRange; Console.WriteLine(columnRange); // RowRange returns range that represents the row area of the Pivot Table var rowRange = pivot.RowRange; Console.WriteLine(rowRange);