@@ -135,6 +135,53 @@ public void RemoveSlideInAnExistingPresentation (string documentDirectory = exis
135
135
throw new FileFormat . Slides . Common . FileFormatException ( "An error occurred." , ex ) ;
136
136
}
137
137
}
138
+ /// <summary>
139
+ ///
140
+ /// </summary>
141
+ /// <param name="documentDirectory"></param>
142
+ /// <param name="filename"></param>
143
+ /// <exception cref="FileFormat.Slides.Common.FileFormatException"></exception>
144
+ public void SetDimensionsOfSlides ( string documentDirectory = existingDocsDirectory , string filename = "test.pptx" )
145
+ {
146
+
147
+ try
148
+ {
149
+ // Create instance of presentation
150
+ Presentation presentation = Presentation . Open ( $ "{ documentDirectory } /{ filename } ") ;
151
+
152
+ presentation . SlideHeight = 400 ;
153
+ presentation . SlideWidth = 700 ;
154
+ //Create instances of text shapes and set their texts.
155
+ TextShape shape = new TextShape ( ) ;
156
+ shape . Text = "Title: Here is my first title From FF" ;
157
+ TextShape shape2 = new TextShape ( ) ;
158
+ shape2 . Text = "Body : Here is my first title From FF" ;
159
+ shape2 . Y = 25.9 ;
160
+ // Create new slide
161
+ Slide slide = new Slide ( ) ;
162
+ // Set background color of slide because default background color is black.
163
+ slide . BackgroundColor = Colors . Silver ;
164
+ // Add text shapes.
165
+ slide . AddTextShapes ( shape ) ;
166
+ slide . AddTextShapes ( shape2 ) ;
167
+ // Adding slides
168
+ presentation . AppendSlide ( slide ) ;
169
+ // Save presentation
170
+ presentation . Save ( ) ;
171
+
172
+ }
173
+ catch ( System . Exception ex )
174
+ {
175
+ throw new FileFormat . Slides . Common . FileFormatException ( "An error occurred." , ex ) ;
176
+ }
177
+
178
+ }
179
+ /// <summary>
180
+ /// Example to add background color to existing slide
181
+ /// </summary>
182
+ /// <param name="documentDirectory"></param>
183
+ /// <param name="filename"></param>
184
+ /// <exception cref="FileFormat.Slides.Common.FileFormatException"></exception>
138
185
public void AddBackgroundColorToAnExistingSlide ( string documentDirectory = existingDocsDirectory , string filename = "test.pptx" )
139
186
{
140
187
0 commit comments