Skip to content

Commit e05f700

Browse files
authored
Merge pull request #207 from SyncfusionExamples/264426-PageBreaksRowIndex
264426-How to get the row index of page breaks in Excel
2 parents c935111 + 0162890 commit e05f700

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36127.28 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Row index of page breaks", "Row index of page breaks\Row index of page breaks.csproj", "{DDEB250A-3853-4563-A6D5-FA903F50A782}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{DDEB250A-3853-4563-A6D5-FA903F50A782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{DDEB250A-3853-4563-A6D5-FA903F50A782}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{DDEB250A-3853-4563-A6D5-FA903F50A782}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{DDEB250A-3853-4563-A6D5-FA903F50A782}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {7E0AAB3A-C736-4B3F-8AEC-66D28D83803F}
24+
EndGlobalSection
25+
EndGlobal

Use Cases/Row index of page breaks/.NET/Row index of page breaks/Row index of page breaks/Output/.gitkeep

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Syncfusion.XlsIO;
2+
3+
class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
using (ExcelEngine excelEngine = new ExcelEngine())
8+
{
9+
IApplication application = excelEngine.Excel;
10+
application.DefaultVersion = ExcelVersion.Xlsx;
11+
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.xlsx"), FileMode.Open, FileAccess.Read);
12+
IWorkbook workbook = application.Workbooks.Open(inputStream);
13+
IWorksheet sheet = workbook.Worksheets[0];
14+
15+
//Access all horizontal page breaks
16+
for (int i = 0; i < sheet.HPageBreaks.Count; i++)
17+
{
18+
int rowIndex = sheet.HPageBreaks[i].Location.Row;
19+
Console.WriteLine($"Page break {i + 1} is at row: {rowIndex}");
20+
}
21+
22+
//Dispose streams
23+
inputStream.Dispose();
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Row_index_of_page_breaks</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\*">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\*">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
</Project>

0 commit comments

Comments
 (0)