@@ -35,6 +35,8 @@ public class SlideFacade
3535
3636 private SlideCommentsPart _CommentPart ;
3737
38+ private NotesSlidePart _NotesPart ;
39+
3840 public Slide PresentationSlide { get => _PresentationSlide ; set => _PresentationSlide = value ; }
3941 public string RelationshipId { get => _RelationshipId ; set => _RelationshipId = value ; }
4042 public SlidePart SlidePart { get => _SlidePart ; set => _SlidePart = value ; }
@@ -45,6 +47,7 @@ public class SlideFacade
4547 public List < TableFacade > TableFacades { get => _TableFacades ; set => _TableFacades = value ; }
4648 public CommentAuthorsPart CommentAuthorPart { get => _CommentAuthorPart ; set => _CommentAuthorPart = value ; }
4749 public SlideCommentsPart CommentPart { get => _CommentPart ; set => _CommentPart = value ; }
50+ public NotesSlidePart NotesPart { get => _NotesPart ; set => _NotesPart = value ; }
4851
4952 public SlideFacade ( bool isNewSlide )
5053 {
@@ -210,6 +213,67 @@ public TextShapeFacade AddTextShape ( List<TextSegmentFacade> textSegmentFacades
210213 return textShapeFacade ;
211214 }
212215
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+ }
213277 public void AddImage ( ImageFacade picture )
214278 {
215279 _PresentationSlide . CommonSlideData . ShapeTree . Append ( picture . Image ) ;
0 commit comments