Skip to content

Commit 098c5e6

Browse files
Updated for v25.1.0
1 parent 00bf682 commit 098c5e6

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

FileFormat.Slides.Examples.Usage/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ static void Main (string[ ] args)
99
{
1010
//SlideExamples slideExamples = new SlideExamples();
1111

12+
//slideExamples.SetDimensionsOfSlides();
13+
1214
//slideExamples.CreateNewSlideInNewPresentation();
1315

1416
//slideExamples.CreateNewSlideInExistingPresentation(filename:"test.pptx");

FileFormat.Slides.Examples/FileFormat.Slides.Examples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="FileFormat.Slides" Version="24.12.1" />
13+
<PackageReference Include="FileFormat.Slides" Version="25.1.0" />
1414
</ItemGroup>
1515

1616
</Project>

FileFormat.Slides.Examples/SlideExamples.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,53 @@ public void RemoveSlideInAnExistingPresentation (string documentDirectory = exis
135135
throw new FileFormat.Slides.Common.FileFormatException("An error occurred.", ex);
136136
}
137137
}
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>
138185
public void AddBackgroundColorToAnExistingSlide (string documentDirectory = existingDocsDirectory, string filename = "test.pptx")
139186
{
140187

0 commit comments

Comments
 (0)