private void btnRun_Click(object sender, EventArgs e) { //Create a PPT document and load file Presentation ppt = new Presentation(); ppt.LoadFromFile(@"..\..\..\..\..\..\Data\AddNote.pptx"); ISlide slide = ppt.Slides[0]; //Add note slide NotesSlide notesSlide = slide.AddNotesSlide(); //Add paragraph in the notesSlide TextParagraph paragraph = new TextParagraph(); paragraph.Text = "Tips for making effective presentations:"; notesSlide.NotesTextFrame.Paragraphs.Append(paragraph); paragraph = new TextParagraph(); paragraph.Text = "Use the slide master feature to create a consistent and simple design template."; notesSlide.NotesTextFrame.Paragraphs.Append(paragraph); //Set the bullet type for the paragraph in notesSlide notesSlide.NotesTextFrame.Paragraphs[1].BulletType = TextBulletType.Numbered; notesSlide.NotesTextFrame.Paragraphs[1].BulletStyle = NumberedBulletStyle.BulletArabicPeriod; paragraph = new TextParagraph(); paragraph.Text = "Simplify and limit the number of words on each screen."; notesSlide.NotesTextFrame.Paragraphs.Append(paragraph); notesSlide.NotesTextFrame.Paragraphs[2].BulletType = TextBulletType.Numbered; notesSlide.NotesTextFrame.Paragraphs[2].BulletStyle = NumberedBulletStyle.BulletArabicPeriod; paragraph = new TextParagraph(); paragraph.Text = "Use contrasting colors for text and background."; notesSlide.NotesTextFrame.Paragraphs.Append(paragraph); notesSlide.NotesTextFrame.Paragraphs[3].BulletType = TextBulletType.Numbered; notesSlide.NotesTextFrame.Paragraphs[3].BulletStyle = NumberedBulletStyle.BulletArabicPeriod; //Save the file ppt.SaveToFile("AddNote.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("AddNote.pptx"); }
private void SlideWithNotes1(IPresentation presentation) { ISlide slide1 = presentation.Slides[0]; IShape shape1 = (IShape)slide1.Shapes[0]; shape1.Left = 1.27 * 72; shape1.Top = 0.56 * 72; shape1.Width = 9.55 * 72; shape1.Height = 5.4 * 72; ITextBody textFrame = shape1.TextBody; IParagraphs paragraphs = textFrame.Paragraphs; paragraphs.Add(); IParagraph paragraph = paragraphs[0]; paragraph.HorizontalAlignment = HorizontalAlignmentType.Left; ITextParts textParts = paragraph.TextParts; textParts.Add(); ITextPart textPart = textParts[0]; textPart.Text = "Essential Presentation "; textPart.Font.CapsType = TextCapsType.All; textPart.Font.FontName = "Calibri Light (Headings)"; textPart.Font.FontSize = 80; textPart.Font.Color = ColorObject.Black; //Adding Notes INotesSlide notesSlide = slide1.AddNotesSlide(); ITextPart notesTextPart = notesSlide.NotesTextBody.Paragraphs[0].TextParts.Add(); notesTextPart.Text = "The slide represents the title content of the presentation"; IPresentationChart chart = notesSlide.Shapes.AddChart(1.24 * 72, 5.71 * 72, 5 * 72, 3.33 * 72); //Specifies the chart title chart.ChartTitle = "Sales Analysis"; //Sets chart data - Row1 chart.ChartData.SetValue(1, 2, "Jan"); chart.ChartData.SetValue(1, 3, "Feb"); chart.ChartData.SetValue(1, 4, "March"); //Sets chart data - Row2 chart.ChartData.SetValue(2, 1, 2010); chart.ChartData.SetValue(2, 2, 60); chart.ChartData.SetValue(2, 3, 70); chart.ChartData.SetValue(2, 4, 80); //Sets chart data - Row3 chart.ChartData.SetValue(3, 1, 2011); chart.ChartData.SetValue(3, 2, 80); chart.ChartData.SetValue(3, 3, 70); chart.ChartData.SetValue(3, 4, 60); //Sets chart data - Row4 chart.ChartData.SetValue(4, 1, 2012); chart.ChartData.SetValue(4, 2, 60); chart.ChartData.SetValue(4, 3, 70); chart.ChartData.SetValue(4, 4, 80); //Creates a new chart series with the name IOfficeChartSerie serieJan = chart.Series.Add("Jan"); //Sets the data range of chart serie – start row, start column, end row, end column serieJan.Values = chart.ChartData[2, 2, 4, 2]; //Creates a new chart series with the name IOfficeChartSerie serieFeb = chart.Series.Add("Feb"); //Sets the data range of chart serie – start row, start column, end row, end column serieFeb.Values = chart.ChartData[2, 3, 4, 3]; //Creates a new chart series with the name IOfficeChartSerie serieMarch = chart.Series.Add("March"); //Sets the data range of chart series – start row, start column, end row, end column serieMarch.Values = chart.ChartData[2, 4, 4, 4]; //Sets the data range of the category axis chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1]; //Specifies the chart type chart.ChartType = OfficeChartType.Column_Clustered; chart.ChartTitle = "Chart inside Notes section"; }