Free Support Forum - aspose.com

How Can I Set Text-String As Note Of Slide


I Want To Set Some Text String AS A notes In slide,

Right Now There is No any Notes In Slide But I Have To Set Some String As Notes In Slide So Plz

Tools:Asp.net (Visual Studio 2005)With C#.

Help Me Plz.....

Dear Chintan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Below is the C# code that adds notes in the first slide. You can also see the output presentation created by this code which is attached by me.

C# Code

-----------------------------------------------------------------------------------------

//Create presentation, it adds one blank slide by default

Presentation srcPres = new Presentation();

//Get the reference to slide by position

//Position can be any number from 1 to Presentation.Slides.LastSlidePosition

Slide srcSld = srcPres.GetSlideByPosition(1);

//Add notes to the slides

srcSld.AddNotes();

//Get access to slide notes

Notes srcNotes = srcSld.Notes;

//The above two lines can also be written as

//Notes srcNotes1 = srcSld.AddNotes();

//One paragraph and one portion is added by default

//Get default paragraph and portion

Paragraph defPara = srcNotes.Paragraphs[0];

Portion defPortion = defPara.Portions[0];

//Add text string

defPortion.Text="This is first portion in the first paragraph.";

//The above lines can aslo be written as

//srcNotes.Paragraphs[0].Portions[0].Text = "This is first portion in the first paragraph.";

//Second paragraph will have to be added programmatically

Paragraph newPara = new Paragraph(defPara);

newPara.Portions[0].Text = "This is first portion in the second paragraph.";

srcNotes.Paragraphs.Add(newPara);

//Add a third pargraph

newPara = new Paragraph(srcNotes.Paragraphs[0]);

newPara.Portions[0].Text = "This is first portion in the third paragraph.";

srcNotes.Paragraphs.Add(newPara);

//Write presentation on disk

srcPres.Write("c:\\outAddingNotes.ppt");

I Got it,

Thank You Very Much, Shakeel Faiz Sir!!