Skip to content

Commit ca386ed

Browse files
author
Konduru Keerthi Konduru Ravichandra Raju
committed
Orientation
1 parent 1749982 commit ca386ed

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed
Binary file not shown.
Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
using Syncfusion.DocIO.DLS;
22
using Syncfusion.DocIO;
33

4-
namespace Set_different_orientation
4+
//Open an existing document
5+
using (WordDocument document = new WordDocument(new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read), FormatType.Docx))
56
{
6-
internal class Program
7-
{
8-
static void Main(string[] args)
9-
{
10-
//Open an existing document
11-
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
12-
{
13-
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
14-
{
15-
//Set different orientations
16-
document.Sections[0].PageSetup.Orientation = PageOrientation.Portrait;
17-
document.Sections[1].PageSetup.Orientation = PageOrientation.Landscape;
18-
document.Sections[2].PageSetup.Orientation = PageOrientation.Portrait;
19-
document.Sections[3].PageSetup.Orientation = PageOrientation.Landscape;
7+
//Set different orientations
8+
document.Sections[0].PageSetup.Orientation = PageOrientation.Portrait;
9+
document.Sections[1].PageSetup.Orientation = PageOrientation.Landscape;
10+
document.Sections[2].PageSetup.Orientation = PageOrientation.Portrait;
11+
document.Sections[3].PageSetup.Orientation = PageOrientation.Landscape;
2012

21-
//Save the Word document
22-
using (FileStream outputStream = new FileStream(@"../../../Output.docx", FileMode.Create, FileAccess.Write))
23-
{
24-
document.Save(outputStream, FormatType.Docx);
25-
}
26-
}
27-
}
28-
}
29-
}
30-
}
13+
//Save the Word document
14+
document.Save(new FileStream(@"../../../Output.docx", FileMode.Create, FileAccess.Write), FormatType.Docx);
15+
}

0 commit comments

Comments
 (0)