diff --git a/FAQ/Pivot Tables End Column/.NET/End Column/End Column.sln b/FAQ/Pivot Tables End Column/.NET/End Column/End Column.sln new file mode 100644 index 00000000..b7b3cc06 --- /dev/null +++ b/FAQ/Pivot Tables End Column/.NET/End Column/End Column.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31729.503 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "End Column", "End Column\End Column.csproj", "{BF68636F-D6AA-49C5-B2AC-858E2B608FD4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BF68636F-D6AA-49C5-B2AC-858E2B608FD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF68636F-D6AA-49C5-B2AC-858E2B608FD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF68636F-D6AA-49C5-B2AC-858E2B608FD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF68636F-D6AA-49C5-B2AC-858E2B608FD4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8443B870-FDE6-49F8-B015-37C3611835D0} + EndGlobalSection +EndGlobal diff --git a/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Data/InputTemplate.xlsx b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Data/InputTemplate.xlsx new file mode 100644 index 00000000..f7034ae3 Binary files /dev/null and b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Data/InputTemplate.xlsx differ diff --git a/FAQ/Pivot Tables End Column/.NET/End Column/End Column/End Column.csproj b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/End Column.csproj new file mode 100644 index 00000000..1a477d6b --- /dev/null +++ b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/End Column.csproj @@ -0,0 +1,25 @@ + + + + Exe + net8.0 + Calculated_Field + + + + + + + + + Always + + + Always + + + + + + + diff --git a/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Output/.gitkeep b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Program.cs b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Program.cs new file mode 100644 index 00000000..d450f932 --- /dev/null +++ b/FAQ/Pivot Tables End Column/.NET/End Column/End Column/Program.cs @@ -0,0 +1,36 @@ +using Syncfusion.XlsIO; +using System; +using System.IO; + +namespace End_Column +{ + class Program + { + static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); + IWorksheet sheet = workbook.Worksheets[1]; + IPivotTable pivotTable = sheet.PivotTables[0]; + + // Ensure layout is calculated + pivotTable.Layout(); + + // Read EndLocation from the implementation type + IRange endRange = (pivotTable as Syncfusion.XlsIO.Implementation.PivotTables.PivotTableImpl).EndLocation; + int lastColumn = endRange.LastColumn; + + // Use lastColumn as needed (e.g., log) + Console.WriteLine("PivotTable last column: " + lastColumn); + } + } + } +} + + + + +