/// <summary> /// Converts PowerPoint presentan to OneNote while converting the sections in power point to main pages, and slides to sub pages /// It creates two notebooks, one for the Trainer and one for the student /// </summary> /// <param name="pptOpenXml"></param> /// <param name="imgsPath"></param> /// <param name="note"></param> /// <param name="sectionName"></param> protected override void ConvertPowerPointToOneNote(PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionName) { string trainerNotebookId = String.Empty; string trainerSectionId = String.Empty; if (IncludeTrainerNotebook()) { // Create the student notebook trainerNotebookId = note.CreateNotebook(TrainerNotebook); trainerSectionId = note.CreateSection(sectionName, trainerNotebookId); } string studentNotebookId = String.Empty; string studentSectionId = String.Empty; if (IncludeStudentNotebook()) { // Create the student notebook studentNotebookId = note.CreateNotebook(StudentNotebook); studentSectionId = note.CreateSection(sectionName, studentNotebookId); } if (pptOpenXml.HasSections()) { List <string> sectionNames = pptOpenXml.GetSectionNames(); List <List <int> > slidesInSections = pptOpenXml.GetSlidesInSections(); if (IncludeTrainerNotebook()) { ConvertPowerPointWithSectionsToOneNote(pptOpenXml, imgsPath, note, trainerSectionId, sectionNames, slidesInSections, true); } if (IncludeStudentNotebook()) { ConvertPowerPointWithSectionsToOneNote(pptOpenXml, imgsPath, note, studentSectionId, sectionNames, slidesInSections, false); } } else { if (IncludeTrainerNotebook()) { ConvertPowerPointWithoutSectionsToOneNote(pptOpenXml, imgsPath, note, trainerSectionId, true); } if (IncludeStudentNotebook()) { ConvertPowerPointWithoutSectionsToOneNote(pptOpenXml, imgsPath, note, studentSectionId, false); } } }
/// <summary> /// Converts PowerPoint presentan to OneNote while converting the sections in power point to main pages, and slides to sub pages /// </summary> /// <param name="pptOpenXml"></param> /// <param name="imgsPath"></param> /// <param name="note"></param> /// <param name="sectionName"></param> protected virtual void ConvertPowerPointToOneNote(PowerPointOpenXml pptOpenXml, string imgsPath, OneNoteGenerator note, string sectionName) { string notebookId = note.CreateNotebook(GetSupportedInputFormat()); string sectionId = note.CreateSection(sectionName, notebookId); if (pptOpenXml.HasSections()) { List <string> sectionNames = pptOpenXml.GetSectionNames(); List <List <int> > slidesInSections = pptOpenXml.GetSlidesInSections(); var pptSectionsPageIds = new List <string>(); for (int i = 0; i < sectionNames.Count; i++) { string pptSectionPageId = note.CreatePage(sectionNames[i], sectionId); foreach (var slideNumber in slidesInSections[i]) { string pageId = InsertPowerPointSlideInOneNote(slideNumber, pptOpenXml, imgsPath, note, sectionId); if (!String.IsNullOrEmpty(pageId)) { note.SetSubPage(sectionId, pageId); } } pptSectionsPageIds.Add(pptSectionPageId); } note.CreateTableOfContentPage(sectionId); foreach (var pptSectionPageId in pptSectionsPageIds) { note.SetCollapsePage(pptSectionPageId); } } else { for (var i = 1; i <= pptOpenXml.NumberOfSlides(); i++) { InsertPowerPointSlideInOneNote(i, pptOpenXml, imgsPath, note, sectionId); } } }
public void ValidateSectionNames() { var sections = _mPptOpenXml.GetSectionNames(); CollectionAssert.AreEqual(PptSections, sections); }