You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/Excel/Excel-Library/NET/Pivot-Table/Pivot-Table-Options.md
+81-1Lines changed: 81 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,4 +334,84 @@ End Using
334
334
{% endhighlight %}
335
335
{% endtabs %}
336
336
337
-
A complete working example to add calculated field in pivot table in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Pivot%20Table/Calculated%20Field/.NET/Calculated%20Field).
337
+
A complete working example to add calculated field in pivot table in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Pivot%20Table/Calculated%20Field/.NET/Calculated%20Field).
338
+
339
+
### Get PivotTable end column
340
+
341
+
To obtain a PivotTable's end column, call PivotTable.Layout(), then read the EndLocation property from the implementation type. The EndLocation range's LastColumn value is the pivot table's last column index.
Dim application As IApplication = excelEngine.Excel
398
+
application.DefaultVersion = ExcelVersion.Xlsx
399
+
400
+
' Open workbook (update path as needed)
401
+
Dim workbook As IWorkbook = application.Workbooks.Open("PivotTable.xlsx")
402
+
403
+
Dim pivotTable As IPivotTable = workbook.Worksheets(0).PivotTables(0)
404
+
405
+
' Calculate layout
406
+
pivotTable.Layout()
407
+
408
+
' Read EndLocation from implementation and get last column
409
+
Dim endRange As IRange = DirectCast(pivotTable, Syncfusion.XlsIO.Implementation.PivotTables.PivotTableImpl).EndLocation
410
+
Dim lastColumn As Integer = endRange.LastColumn
411
+
412
+
Console.WriteLine("PivotTable last column: " & lastColumn)
413
+
End Using
414
+
{% endhighlight %}
415
+
{% endtabs %}
416
+
417
+
A complete working example to get the end column of a pivot table in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Pivot%20Table/End%20Column/.NET/End%20Column).
0 commit comments