11using Syncfusion . DocIO . DLS ;
22using 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