@@ -35,6 +35,8 @@ public class SlideFacade
35
35
36
36
private SlideCommentsPart _CommentPart ;
37
37
38
+ private NotesSlidePart _NotesPart ;
39
+
38
40
public Slide PresentationSlide { get => _PresentationSlide ; set => _PresentationSlide = value ; }
39
41
public string RelationshipId { get => _RelationshipId ; set => _RelationshipId = value ; }
40
42
public SlidePart SlidePart { get => _SlidePart ; set => _SlidePart = value ; }
@@ -45,6 +47,7 @@ public class SlideFacade
45
47
public List < TableFacade > TableFacades { get => _TableFacades ; set => _TableFacades = value ; }
46
48
public CommentAuthorsPart CommentAuthorPart { get => _CommentAuthorPart ; set => _CommentAuthorPart = value ; }
47
49
public SlideCommentsPart CommentPart { get => _CommentPart ; set => _CommentPart = value ; }
50
+ public NotesSlidePart NotesPart { get => _NotesPart ; set => _NotesPart = value ; }
48
51
49
52
public SlideFacade ( bool isNewSlide )
50
53
{
@@ -210,6 +213,67 @@ public TextShapeFacade AddTextShape ( List<TextSegmentFacade> textSegmentFacades
210
213
return textShapeFacade ;
211
214
}
212
215
216
+ public void AddNote ( String noteText )
217
+ {
218
+ var relId = _RelationshipId ;
219
+
220
+ NotesSlidePart notesSlidePart1 ;
221
+ string existingSlideNote = noteText ;
222
+
223
+ if ( _SlidePart . NotesSlidePart != null )
224
+ {
225
+ //Appened new note to existing note.
226
+ existingSlideNote = _SlidePart . NotesSlidePart . NotesSlide . InnerText + "\n " + noteText ;
227
+ //var val = (NotesSlidePart)_SlidePart.GetPartById(relId);
228
+ //var val = _SlidePart.NotesSlidePart;
229
+ notesSlidePart1 = _NotesPart ;
230
+ }
231
+ else
232
+ {
233
+ //Add a new noteto a slide.
234
+ notesSlidePart1 = _SlidePart . AddNewPart < NotesSlidePart > ( relId ) ;
235
+ }
236
+
237
+ NotesSlide notesSlide = new NotesSlide (
238
+ new CommonSlideData ( new ShapeTree (
239
+ new P . NonVisualGroupShapeProperties (
240
+ new P . NonVisualDrawingProperties ( ) { Id = ( UInt32Value ) 1U , Name = "" } ,
241
+ new P . NonVisualGroupShapeDrawingProperties ( ) ,
242
+ new ApplicationNonVisualDrawingProperties ( ) ) ,
243
+ new GroupShapeProperties ( new D . TransformGroup ( ) ) ,
244
+ new P . Shape (
245
+ new P . NonVisualShapeProperties (
246
+ new P . NonVisualDrawingProperties ( ) { Id = ( UInt32Value ) 2U , Name = "Slide Image Placeholder 1" } ,
247
+ new P . NonVisualShapeDrawingProperties ( new D . ShapeLocks ( ) { NoGrouping = true , NoRotation = true , NoChangeAspect = true } ) ,
248
+ new ApplicationNonVisualDrawingProperties ( new PlaceholderShape ( ) { Type = PlaceholderValues . SlideImage } ) ) ,
249
+ new P . ShapeProperties ( ) ) ,
250
+ new P . Shape (
251
+ new P . NonVisualShapeProperties (
252
+ new P . NonVisualDrawingProperties ( ) { Id = ( UInt32Value ) 3U , Name = "Notes Placeholder 2" } ,
253
+ new P . NonVisualShapeDrawingProperties ( new D . ShapeLocks ( ) { NoGrouping = true } ) ,
254
+ new ApplicationNonVisualDrawingProperties ( new PlaceholderShape ( ) { Type = PlaceholderValues . Body , Index = ( UInt32Value ) 1U } ) ) ,
255
+ new P . ShapeProperties ( ) ,
256
+ new P . TextBody (
257
+ new D . BodyProperties ( ) ,
258
+ new D . ListStyle ( ) ,
259
+ new D . Paragraph (
260
+ new D . Run (
261
+ new D . RunProperties ( ) { Language = "en-US" , Dirty = false } ,
262
+ new D . Text ( ) { Text = existingSlideNote } ) ,
263
+ new D . EndParagraphRunProperties ( ) { Language = "en-US" , Dirty = false } ) )
264
+ ) ) ) ,
265
+ new ColorMapOverride ( new D . MasterColorMapping ( ) ) ) ;
266
+
267
+ notesSlidePart1 . NotesSlide = notesSlide ;
268
+ }
269
+ public void RemoveNote ( )
270
+ {
271
+ if ( _SlidePart . NotesSlidePart != null )
272
+ {
273
+ // Clear the existing notes.
274
+ _SlidePart . DeletePart ( _SlidePart . NotesSlidePart ) ;
275
+ }
276
+ }
213
277
public void AddImage ( ImageFacade picture )
214
278
{
215
279
_PresentationSlide . CommonSlideData . ShapeTree . Append ( picture . Image ) ;
0 commit comments