diff --git a/Worksheet Features/Orientation/.NET/Orientation/Orientation.slnx b/Worksheet Features/Orientation/.NET/Orientation/Orientation.slnx new file mode 100644 index 00000000..cd412ce0 --- /dev/null +++ b/Worksheet Features/Orientation/.NET/Orientation/Orientation.slnx @@ -0,0 +1,3 @@ + + + diff --git a/Worksheet Features/Orientation/.NET/Orientation/Orientation/Data/InputTemplate.xlsx b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Data/InputTemplate.xlsx new file mode 100644 index 00000000..13a70e61 Binary files /dev/null and b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Data/InputTemplate.xlsx differ diff --git a/Worksheet Features/Orientation/.NET/Orientation/Orientation/Orientation.csproj b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Orientation.csproj new file mode 100644 index 00000000..39a86120 --- /dev/null +++ b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Orientation.csproj @@ -0,0 +1,23 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/Worksheet Features/Orientation/.NET/Orientation/Orientation/Output/.gitkeep b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Worksheet Features/Orientation/.NET/Orientation/Orientation/Program.cs b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Program.cs new file mode 100644 index 00000000..a609b2fc --- /dev/null +++ b/Worksheet Features/Orientation/.NET/Orientation/Orientation/Program.cs @@ -0,0 +1,25 @@ +using System.IO; +using Syncfusion.XlsIO; + +namespace Orientation +{ + 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 worksheet = workbook.Worksheets[0]; + + //Set the page orientation + worksheet.PageSetup.Orientation = ExcelPageOrientation.Landscape; + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); + } + } + } +} \ No newline at end of file diff --git a/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize.slnx b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize.slnx new file mode 100644 index 00000000..044c2f00 --- /dev/null +++ b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize.slnx @@ -0,0 +1,3 @@ + + + diff --git a/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Data/InputTemplate.xlsx b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Data/InputTemplate.xlsx new file mode 100644 index 00000000..54619c06 Binary files /dev/null and b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Data/InputTemplate.xlsx differ diff --git a/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Output/.gitkeep b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/PaperSize.csproj b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/PaperSize.csproj new file mode 100644 index 00000000..39a86120 --- /dev/null +++ b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/PaperSize.csproj @@ -0,0 +1,23 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Program.cs b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Program.cs new file mode 100644 index 00000000..465dbc59 --- /dev/null +++ b/Worksheet Features/PaperSize/.NET/PaperSize/PaperSize/Program.cs @@ -0,0 +1,25 @@ +using System.IO; +using Syncfusion.XlsIO; + +namespace PaperSize +{ + 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 worksheet = workbook.Worksheets[0]; + + //Set the paper size to A4 + worksheet.PageSetup.PaperSize = ExcelPaperSize.PaperA4; + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); + } + } + } +} \ No newline at end of file