-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSamples.Presentation.cs
More file actions
67 lines (58 loc) · 2.4 KB
/
Copy pathSamples.Presentation.cs
File metadata and controls
67 lines (58 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using DocumentFormat.OpenXml.Presentation;
using Drawing = DocumentFormat.OpenXml.Drawing;
public partial class Samples
{
[Test]
public void Presentation()
{
using var stream = new MemoryStream();
#region create-presentation
using var writer = StreamingDocument.CreatePresentation(stream, leaveOpen: true);
writer.WritePart(
new("/ppt/presentation.xml", UriKind.Relative),
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",
new Presentation(new SlideIdList()));
#endregion
}
[Test]
public async Task PresentationBuilderSample()
{
using var stream = new MemoryStream();
#region presentation-builder
await using var presentation = new StreamingPresentationBuilder(stream, leaveOpen: true);
// No theme/master/layout boilerplate — the builder writes a default
// scaffolding on the first AddSlide call.
presentation.AddSlide(
new(
new CommonSlideData(
new ShapeTree(
new NonVisualGroupShapeProperties(
new NonVisualDrawingProperties
{
Id = 1,
Name = ""
},
new NonVisualGroupShapeDrawingProperties(),
new ApplicationNonVisualDrawingProperties()),
new GroupShapeProperties(
new Drawing.TransformGroup())))));
presentation.AddSlide(
new(
new CommonSlideData(
new ShapeTree(
new NonVisualGroupShapeProperties(
new NonVisualDrawingProperties
{
Id = 1,
Name = ""
},
new NonVisualGroupShapeDrawingProperties(),
new ApplicationNonVisualDrawingProperties()),
new GroupShapeProperties(
new Drawing.TransformGroup())))));
// DisposeAsync writes ppt/presentation.xml referencing the slide
// master and every slide that was added.
#endregion
await Task.CompletedTask;
}
}