Skip to content

Commit

Permalink
PageSetup Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurmitha4004 committed Feb 11, 2024
1 parent 95ad38e commit 48b1897
Show file tree
Hide file tree
Showing 31 changed files with 829 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FitToPagesTall", "FitToPagesTall\FitToPagesTall.csproj", "{AC18DB6C-1FE2-4C78-9F0E-7330994F596B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AC18DB6C-1FE2-4C78-9F0E-7330994F596B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC18DB6C-1FE2-4C78-9F0E-7330994F596B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC18DB6C-1FE2-4C78-9F0E-7330994F596B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC18DB6C-1FE2-4C78-9F0E-7330994F596B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A8E6A34F-583F-421D-B41D-8B554C71A9BF}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="24.2.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.IO;
using Syncfusion.XlsIO;

namespace FitToPagesTall
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

for (int i = 1; i <= 50; i++)
{
for (int j = 1; j <= 50; j++)
{
sheet.Range[i, j].Text = sheet.Range[i, j].AddressLocal;
}
}

#region PageSetup Settings
//Sets the fit to page tall as true.
sheet.PageSetup.FitToPagesTall = 1;
sheet.PageSetup.FitToPagesWide = 0;

#endregion

#region Save
//Saving the workbook
FileStream outputStream = new FileStream("FitToPagesTall.xlsx", FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
#endregion

//Dispose streams
outputStream.Dispose();

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo("FitToPagesTall.xlsx")
{
UseShellExecute = true
};
process.Start();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FitToPagesWide", "FitToPagesWide\FitToPagesWide.csproj", "{1658D86B-EFEF-4057-A2E5-2074B96B339A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1658D86B-EFEF-4057-A2E5-2074B96B339A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1658D86B-EFEF-4057-A2E5-2074B96B339A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1658D86B-EFEF-4057-A2E5-2074B96B339A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1658D86B-EFEF-4057-A2E5-2074B96B339A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB9EC331-8D2D-43D9-ACEE-DA1563E0013F}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="24.2.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.IO;
using Syncfusion.XlsIO;

namespace FitToPagesWide
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

for (int i = 1; i <= 50; i++)
{
for (int j = 1; j <= 50; j++)
{
sheet.Range[i, j].Text = sheet.Range[i, j].AddressLocal;
}
}

#region PageSetup Settings
//Sets the fit to page wide as true.
sheet.PageSetup.FitToPagesWide = 1;
sheet.PageSetup.FitToPagesTall = 0;

#endregion

#region Save
//Saving the workbook
FileStream outputStream = new FileStream("FitToPagesWide.xlsx", FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
#endregion

//Dispose streams
outputStream.Dispose();

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo("FitToPagesWide.xlsx")
{
UseShellExecute = true
};
process.Start();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IsFitToPage", "IsFitToPage\IsFitToPage.csproj", "{B600E65C-B401-41C9-9531-A4351E47490D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B600E65C-B401-41C9-9531-A4351E47490D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B600E65C-B401-41C9-9531-A4351E47490D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B600E65C-B401-41C9-9531-A4351E47490D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B600E65C-B401-41C9-9531-A4351E47490D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {50FE01D0-7F3F-4D04-975F-90FD648755C9}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="24.2.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.IO;
using Syncfusion.XlsIO;

namespace PageSetup
namespace IsFitToPage
{
class Program
{
Expand All @@ -23,30 +23,22 @@ static void Main(string[] args)
}

#region PageSetup Settings
//Set Horizontal Page Breaks
sheet.HPageBreaks.Add(sheet.Range["A5"]);
//Set Vertical Page Breaks
sheet.VPageBreaks.Add(sheet.Range["B5"]);
// True to fit the content before printing
sheet.PageSetup.IsFitToPage = true;

//Set print title
sheet.PageSetup.PrintTitleColumns = "$B:$E";
sheet.PageSetup.PrintTitleRows = "$2:$5";

//Set Page Orientation as Portrait or Landscape
sheet.PageSetup.Orientation = ExcelPageOrientation.Landscape;
#endregion

#region Save
//Saving the workbook
FileStream outputStream = new FileStream("PageSetup-Settings.xlsx", FileMode.Create, FileAccess.Write);
FileStream outputStream = new FileStream("IsFitToPage.xlsx", FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
#endregion

//Dispose streams
outputStream.Dispose();

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo("PageSetup-Settings.xlsx")
process.StartInfo = new System.Diagnostics.ProcessStartInfo("IsFitToPage.xlsx")
{
UseShellExecute = true
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IsSummaryColumnRight", "IsSummaryColumnRight\IsSummaryColumnRight.csproj", "{90B6BF4E-2959-424F-8B6D-FB49E3ADBDD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{90B6BF4E-2959-424F-8B6D-FB49E3ADBDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90B6BF4E-2959-424F-8B6D-FB49E3ADBDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90B6BF4E-2959-424F-8B6D-FB49E3ADBDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90B6BF4E-2959-424F-8B6D-FB49E3ADBDD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5ADB984E-B3DD-4AF1-9683-C58231B45EEA}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="24.2.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.IO;
using Syncfusion.XlsIO;

namespace IsSummaryColumnRight
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

for (int i = 1; i <= 50; i++)
{
for (int j = 1; j <= 50; j++)
{
sheet.Range[i, j].Text = sheet.Range[i, j].AddressLocal;
}
}

#region PageSetup Settings
//True to summary columns will appear right of the detail in outlines
sheet.PageSetup.IsSummaryColumnRight = true;
sheet.PageSetup.Orientation = ExcelPageOrientation.Portrait;
sheet.PageSetup.FitToPagesTall = 0;
sheet.PageSetup.IsFitToPage = true;

#endregion

#region Save
//Saving the workbook
FileStream outputStream = new FileStream("SummaryColumnRight.xlsx", FileMode.Create, FileAccess.Write);
workbook.SaveAs(outputStream);
#endregion

//Dispose streams
outputStream.Dispose();

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo("SummaryColumnRight.xlsx")
{
UseShellExecute = true
};
process.Start();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34310.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IsSummaryRowBelow", "IsSummaryRowBelow\IsSummaryRowBelow.csproj", "{7D95F12A-E38C-4815-AFB7-83B44414B322}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7D95F12A-E38C-4815-AFB7-83B44414B322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D95F12A-E38C-4815-AFB7-83B44414B322}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D95F12A-E38C-4815-AFB7-83B44414B322}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D95F12A-E38C-4815-AFB7-83B44414B322}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5993ABCC-F351-47F0-B609-962A7805214D}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 48b1897

Please sign in to comment.