public void TestPassthroughPptxDocumentWithHiddenSlides() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } } Assert.IsTrue(CommonTestUtilities.AreZipFilesEqual(TEST_PPT, TEST_OUTPUT_FILE)); using (PptxDocumentProcessor pdpII = new PptxDocumentProcessor(File.Open(TEST_OUTPUT_FILE, FileMode.Open))) { pdpII.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdpII.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdpII.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttHiddenSlide = pdpII.DocumentText.GetTextTypes(ContentType.HiddenSlide)[0] as TextType; Assert.IsNotNull(ttHiddenSlide); Assert.AreEqual(2, ttHiddenSlide.GetChildCount()); Assert.AreEqual("2", ttHiddenSlide.GetChild(0).GetInfo("SlideNumber")[0].value); Assert.AreEqual("3", ttHiddenSlide.GetChild(1).GetInfo("SlideNumber")[0].value); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestPassthroughPptxDocumentEmptyPresentation() { string TEST_PPT = TESTFILE_DIR + "test001.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } } Assert.IsTrue(CommonTestUtilities.AreZipFilesEqual(TEST_PPT, TEST_OUTPUT_FILE)); using (OPCPackage package = new OPCPackage(File.Open(TEST_OUTPUT_FILE, FileMode.Open))) { foreach (ContentTypeInfo cti in package.GetContentTypes()) { if (cti.Name == "/docProps/thumbnail.jpeg") Assert.Fail("Ooops, put in overrides of content types for parts that didn't have override info"); } } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestDiscoverPptmComments() { string TEST_PPT = TESTFILE_DIR + "test003.pptm.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttComments = pdp.DocumentText.GetTextTypes(ContentType.Comment)[0] as TextType; Assert.IsNotNull(ttComments); Assert.AreEqual(3, ttComments.GetChildCount()); Assert.AreEqual("hjrehjkwr\n", ttComments.GetChild(0).GetInfo("Content")[0].value); Assert.AreEqual("Mena Shervill", ttComments.GetChild(0).GetInfo("Author")[0].value); Assert.AreEqual("Another comment", ttComments.GetChild(1).GetInfo("Content")[0].value); Assert.AreEqual("bobh", ttComments.GetChild(1).GetInfo("Author")[0].value); Assert.AreEqual("For use as no doubt", ttComments.GetChild(2).GetInfo("Content")[0].value); Assert.AreEqual("bobh", ttComments.GetChild(2).GetInfo("Author")[0].value); } }
public void TestCleanPptxDocumentWithFields_ActuallyOLEObjects() { string TEST_PPT = TESTFILE_DIR + "test007.pptx"; try { Assert.IsTrue(PptxTestUtilities.DocumentContainsEmbeddedObjects(TEST_PPT), "Embedded object left in document"); using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.Clean); } } using (PptxDocumentProcessor pdpII = new PptxDocumentProcessor(File.Open(TEST_OUTPUT_FILE, FileMode.Open))) { pdpII.Process(DocumentProcessingActions.Discover); DocumentText dt = pdpII.DocumentText; Assert.IsNotNull(dt, "expected the document text object to be valid"); List<IAbstractTextType> listFields = pdpII.DocumentText.GetTextTypes(ContentType.Field); Assert.IsNotNull(listFields, "Clean documents should have empty lists"); Assert.AreEqual(0, listFields.Count, "Clean documents should have empty lists"); } Assert.IsFalse(PptxTestUtilities.DocumentContainsEmbeddedObjects(TEST_OUTPUT_FILE), "Embedded object left in document"); } finally { File.Delete(TEST_OUTPUT_FILE); } }
public PptxPresentationPartFilter(CommonNamespaces commonNamespaces, PptxDocumentProcessor docproc, bool interestedInHiddenSlides) : base(commonNamespaces) { m_parentDocProc = docproc; Triggers.AddRange(PptxMetadataDefinitions.Hyperlink); m_interestedInHiddenSlides = interestedInHiddenSlides; }
public override DocumentText Read() { using (PptxDocumentProcessor dp = new PptxDocumentProcessor(m_data.AsStream())) { dp.Process(DocumentProcessingActions.Discover); return dp.DocumentText; } }
public void CleanTo(Stream strDest, List<ContentType> elementsToClean) { using (PptxDocumentProcessor dp = new PptxDocumentProcessor(m_data.AsStream(), elementsToClean)) { dp.Output = strDest; dp.Process(DocumentProcessingActions.Clean); strDest.Close(); } }
public void CleanTo(Stream strDest) { using (PptxDocumentProcessor dp = new PptxDocumentProcessor(m_data.AsStream())) { dp.Output = strDest; dp.Process(DocumentProcessingActions.Clean); strDest.Close(); } }
public void TestSorting_SlideOrder() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } PptxPresentationPartFilter ppf = pdp.GetPresentationPartFilter() as PptxPresentationPartFilter; Assert.IsNotNull(ppf); List<PartInfo> srpl = ppf.SortedRelatedParts; Assert.AreEqual(9, srpl.Count, "Different number of related parts"); PartInfo pi = srpl[0]; Assert.AreEqual("rId2", pi.Id); Assert.AreEqual("slides/slide1.xml", pi.Target); pi = srpl[1]; Assert.AreEqual("rId3", pi.Id); Assert.AreEqual("slides/slide2.xml", pi.Target); pi = srpl[2]; Assert.AreEqual("rId4", pi.Id); Assert.AreEqual("slides/slide3.xml", pi.Target); pi = srpl[3]; Assert.AreEqual("rId8", pi.Id); Assert.AreEqual("theme/theme1.xml", pi.Target); pi = srpl[4]; Assert.AreEqual("rId7", pi.Id); Assert.AreEqual("viewProps.xml", pi.Target); pi = srpl[5]; Assert.AreEqual("rId1", pi.Id); Assert.AreEqual("slideMasters/slideMaster1.xml", pi.Target); pi = srpl[6]; Assert.AreEqual("rId6", pi.Id); Assert.AreEqual("presProps.xml", pi.Target); pi = srpl[7]; Assert.AreEqual("rId5", pi.Id); Assert.AreEqual("notesMasters/notesMaster1.xml", pi.Target); pi = srpl[8]; Assert.AreEqual("rId9", pi.Id); Assert.AreEqual("tableStyles.xml", pi.Target); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestDiscoverPptxHiddenSlides() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttHiddenSlide = pdp.DocumentText.GetTextTypes(ContentType.HiddenSlide)[0] as TextType; Assert.IsNotNull(ttHiddenSlide); Assert.AreEqual(2, ttHiddenSlide.GetChildCount()); Assert.AreEqual("2", ttHiddenSlide.GetChild(0).GetInfo("SlideNumber")[0].value); Assert.AreEqual("3", ttHiddenSlide.GetChild(1).GetInfo("SlideNumber")[0].value); } }
public void TestHiddenSlideLookupByTargetName() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } Assert.IsFalse(pdp.IsSlideHidden("burble"), "Invalid target so can't be hidden"); Assert.IsFalse(pdp.IsSlideHidden("slides/slide1.xml"), "Only slide 1 should be visible"); Assert.IsTrue(pdp.IsSlideHidden("slides/slide2.xml"), "Only slide 1 should be visible"); Assert.IsTrue(pdp.IsSlideHidden("slides/slide3.xml"), "Only slide 1 should be visible"); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestHiddenSlideLookup() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } Assert.IsFalse(pdp.IsSlideHidden(0), "Uses number not index so can't be hidden"); Assert.IsFalse(pdp.IsSlideHidden(1), "Only slide 1 should be visible"); Assert.IsTrue(pdp.IsSlideHidden(2), "Only slide 1 should be visible"); Assert.IsTrue(pdp.IsSlideHidden(3), "Only slide 1 should be visible"); Assert.IsFalse(pdp.IsSlideHidden(4), "Value out of range so can't be hidden"); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestDiscoverPptxDocumentContentEverywhere() { string TEST_PPT = TESTFILE_DIR + "test027.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttParaText = pdp.DocumentText.GetTextTypes(ContentType.Paragraph)[0] as TextType; Assert.IsNotNull(ttParaText); CheckContentNode(ttParaText, "Table on slide"); CheckContentNode(ttParaText, "Note on slide"); CheckContentNode(ttParaText, "Footer on slide master"); CheckContentNode(ttParaText, "Table on slide master"); CheckContentNode(ttParaText, "Table on notes master"); CheckContentNode(ttParaText, "Footer on notes master"); CheckContentNode(ttParaText, "Table on handout master"); CheckContentNode(ttParaText, "Footer on handout master"); CheckContentNode(ttParaText, "Comment Text"); } }
public void TestDiscoverPptxHyperlinks() { string TEST_PPT = TESTFILE_DIR + "test004.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttHyperlinks = pdp.DocumentText.GetTextTypes(ContentType.Hyperlink)[0] as TextType; Assert.IsNotNull(ttHyperlinks); Assert.AreEqual(1, ttHyperlinks.GetChildCount()); Assert.AreEqual("Hyperlink", ttHyperlinks.GetChild(0).GetInfo("Target")[0].value); } }
public void TestGetSlideRelIdFromPosition() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } PptxPresentationPartFilter ppf = pdp.GetPresentationPartFilter() as PptxPresentationPartFilter; Assert.IsNotNull(ppf); Assert.AreEqual(string.Empty, ppf.GetSlideRelIdFromPosition(0)); Assert.AreEqual("rId2", ppf.GetSlideRelIdFromPosition(1)); Assert.AreEqual("rId3", ppf.GetSlideRelIdFromPosition(2)); Assert.AreEqual("rId4", ppf.GetSlideRelIdFromPosition(3)); Assert.AreEqual(string.Empty, ppf.GetSlideRelIdFromPosition(4)); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestReadInkAnnotations_5() { string TEST_PPT = TESTFILE_DIR + "Test Simple with annotation.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttInks = pdp.DocumentText.GetTextTypes(ContentType.InkAnnotation)[0] as TextType; Assert.IsNotNull(ttInks); Assert.AreEqual(1, ttInks.GetChildCount()); Assert.AreEqual(@"../ink/ink1.xml", ttInks.GetChild(0).GetInfo("Source")[0].value); } }
public void TestReadInkAnnotations_6() { string TEST_PPT = TESTFILE_DIR + "Test Multiple Slides Annotations.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttInks = pdp.DocumentText.GetTextTypes(ContentType.InkAnnotation)[0] as TextType; Assert.IsNotNull(ttInks); Assert.AreEqual(27, ttInks.GetChildCount()); for (int i = 0; i != 27; i++) { var value = ttInks.GetChild(i).GetInfo("Source")[0].value; Assert.True(value.StartsWith(@"../ink/ink")); Assert.True(value.EndsWith(@".xml")); } } }
public void TestDiscoverHyperlinksInDiagrams() { string TEST_PPT = TESTFILE_DIR + "Test Smart Art Hyperlinks.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); DocumentText dt = pdp.DocumentText; TextType ttHyperlink = pdp.DocumentText.GetTextTypes(ContentType.Hyperlink)[0] as TextType; Assert.AreEqual(3, ttHyperlink.GetChildCount(), "expected it to find three hyperlink items"); TextType ttParagraphText = pdp.DocumentText.GetTextTypes(ContentType.Paragraph)[0] as TextType; Assert.AreEqual(15, ttParagraphText.GetChildCount(), "expected it to find 15 paragraph text items (including the comment)"); } }
public void TestDiscoverPptmDocumentWithFooter() { string TEST_PPT = TESTFILE_DIR + "test021.pptm.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttFooter = pdp.DocumentText.GetTextTypes(ContentType.Footer)[0] as TextType; Assert.IsNotNull(ttFooter); Assert.Greater(ttFooter.GetChildCount(), 0); } }
public void TestDiscoverDiagrams() { string TEST_PPT = TESTFILE_DIR + "Test Ppt Smart Art.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); DocumentText dt = pdp.DocumentText; TextType ttWhiteText = pdp.DocumentText.GetTextTypes(ContentType.WhiteText)[0] as TextType; Assert.AreEqual(3, ttWhiteText.GetChildCount(), "expected it to find three white text items"); TextType ttParagraphText = pdp.DocumentText.GetTextTypes(ContentType.Paragraph)[0] as TextType; Assert.AreEqual(22, ttParagraphText.GetChildCount(), "expected it to find 22 paragraph text items"); } }
public void TestDiscoverPotmTemplateWithComments() { string TEST_PPT = TESTFILE_DIR + "test023.potm.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttComments = pdp.DocumentText.GetTextTypes(ContentType.Comment)[0] as TextType; Assert.IsNotNull(ttComments); Assert.AreEqual(2, ttComments.GetChildCount()); Assert.AreEqual("inserted comment from 2003", ttComments.GetChild(0).GetInfo("Content")[0].value); Assert.AreEqual("qaadmin", ttComments.GetChild(0).GetInfo("Author")[0].value); Assert.AreEqual("comment on a hidden sheet", ttComments.GetChild(1).GetInfo("Content")[0].value); Assert.AreEqual("qaadmin", ttComments.GetChild(1).GetInfo("Author")[0].value); } }
public void TestDiscoverPptxDocumentStatistics() { string TEST_PPT = TESTFILE_DIR + "test024.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttDocStats = pdp.DocumentText.GetTextTypes(ContentType.DocumentStatistic)[0] as TextType; Assert.IsNotNull(ttDocStats); Assert.AreEqual(5, ttDocStats.GetChildCount()); Assert.AreEqual("LastAuthor", ttDocStats.GetChild(0).GetInfo("Name")[0].value); Assert.AreEqual("RevisionNumber", ttDocStats.GetChild(1).GetInfo("Name")[0].value); Assert.AreEqual("CreatedTime", ttDocStats.GetChild(2).GetInfo("Name")[0].value); Assert.AreEqual("LastSaveTime", ttDocStats.GetChild(3).GetInfo("Name")[0].value); Assert.AreEqual("EditTime", ttDocStats.GetChild(4).GetInfo("Name")[0].value); } }
public void TestDiscoverPptxBuiltinProps() { string TEST_PPT = TESTFILE_DIR + "test002.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; Assert.Greater(dt.GetTextTypes(ContentType.BuiltInProperty).Count, 0, "No built inproperty type found"); IAbstractTextType ttProps = dt.GetTextTypes(ContentType.BuiltInProperty)[0]; Assert.AreEqual(2, ttProps.GetChildCount()); CheckNode(ttProps, "Title", "PowerPoint Presentation"); CheckNode(ttProps, "Author", "lnpair"); } }
public void TestDiscoverPptxDocumentWithFooterOnSlide() // they don't do headers { string TEST_PPT = TESTFILE_DIR + "test026.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttFooters = pdp.DocumentText.GetTextTypes(ContentType.Footer)[0] as TextType; Assert.IsNotNull(ttFooters); Assert.AreEqual(2, ttFooters.GetChildCount(), "Also see the 1 on the master which can be different"); Assert.AreEqual("Slide can only have a footer", ttFooters.GetChild(0).GetInfo("Content")[0].value); Assert.AreEqual("This is on the master", ttFooters.GetChild(1).GetInfo("Content")[0].value); } }
public void TestPassthroughPptxDocumentPostItNoteComments() { string TEST_PPT = TESTFILE_DIR + "test032.pptm.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_M_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } } Assert.IsTrue(CommonTestUtilities.AreZipFilesEqual(TEST_PPT, TEST_OUTPUT_M_FILE)); using (PptxDocumentProcessor pdpII = new PptxDocumentProcessor(File.Open(TEST_OUTPUT_M_FILE, FileMode.Open))) { pdpII.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdpII.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdpII.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttComments = pdpII.DocumentText.GetTextTypes(ContentType.Comment)[0] as TextType; Assert.IsNotNull(ttComments); Assert.AreEqual(2, ttComments.GetChildCount()); Assert.AreEqual("enjing:Ifyoursubscription has expired, and you choose to download ", ttComments.GetChild(1).GetInfo("Content")[0].value); } } finally { File.Delete(TEST_OUTPUT_M_FILE); } }
public void TestPptxDocumentCommentAuthorWithNoComment() { string TEST_PPT = TESTFILE_DIR + "test029.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); List<IAbstractTextType> lttComments = pdp.DocumentText.GetTextTypes(ContentType.Comment); Assert.IsTrue(lttComments.Count == 0); } }
public void TestDiscoverPptxDocumentWith() { string TEST_PPT = TESTFILE_DIR + "test032.pptm.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); DocumentText dt = pdp.DocumentText; TextType ttComments = pdp.DocumentText.GetTextTypes(ContentType.Comment)[0] as TextType; Assert.IsNotNull(ttComments); Assert.AreEqual(2, ttComments.GetChildCount()); //Assert.AreEqual(<- Chinese chars so don't do this ->, ttComments.GetChild(0).GetInfo("Content")[0].value); Assert.AreEqual("enjing:Ifyoursubscription has expired, and you choose to download ", ttComments.GetChild(1).GetInfo("Content")[0].value); //Assert.AreEqual(<- May discuss rules on author ->, ttComments.GetChild(1).GetInfo("Author")[0].value); } }
public void TestDiscoverPptxDocumentFootersEverywhere() { string TEST_PPT = TESTFILE_DIR + "test030.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdp.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdp.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttFooter = pdp.DocumentText.GetTextTypes(ContentType.Footer)[0] as TextType; Assert.IsNotNull(ttFooter); CheckContentNode(ttFooter, "footer from slide 1"); CheckContentNode(ttFooter, "footer from slide 2"); CheckContentNode(ttFooter, "footer from slide master"); CheckContentNode(ttFooter, "footer from notes master"); CheckContentNode(ttFooter, "footer from handout master"); } }
public void TestPassthroughPptxDocumentWithComments() { string TEST_PPT = TESTFILE_DIR + "test003.pptx"; try { using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { using (pdp.Output = File.Open(TEST_OUTPUT_FILE, FileMode.CreateNew)) { pdp.Process(DocumentProcessingActions.PassThrough); } } Assert.IsTrue(CommonTestUtilities.AreZipFilesEqual(TEST_PPT, TEST_OUTPUT_FILE)); using (PptxDocumentProcessor pdpII = new PptxDocumentProcessor(File.Open(TEST_OUTPUT_FILE, FileMode.Open))) { pdpII.Process(DocumentProcessingActions.Discover); Assert.IsNotNull(pdpII.DocumentText, "expected the document text object to be valid"); Assert.Greater(pdpII.DocumentText.GetTextTypes().Count, 0, "expected some document text types to have been added"); TextType ttComments = pdpII.DocumentText.GetTextTypes(ContentType.Comment)[0] as TextType; Assert.IsNotNull(ttComments); Assert.AreEqual(3, ttComments.GetChildCount()); Assert.AreEqual("hjrehjkwr\n", ttComments.GetChild(0).GetInfo("Content")[0].value); Assert.AreEqual("Mena Shervill", ttComments.GetChild(0).GetInfo("Author")[0].value); Assert.AreEqual("Another comment", ttComments.GetChild(1).GetInfo("Content")[0].value); Assert.AreEqual("bobh", ttComments.GetChild(1).GetInfo("Author")[0].value); Assert.AreEqual("For use as no doubt", ttComments.GetChild(2).GetInfo("Content")[0].value); Assert.AreEqual("bobh", ttComments.GetChild(2).GetInfo("Author")[0].value); } } finally { File.Delete(TEST_OUTPUT_FILE); } }
public void TestDiscoverContentWithBrTags() { string TEST_PPT = TESTFILE_DIR + "test031.pptx"; using (PptxDocumentProcessor pdp = new PptxDocumentProcessor(File.Open(TEST_PPT, FileMode.Open))) { pdp.Process(DocumentProcessingActions.Discover); DocumentText dt = pdp.DocumentText; TextType ttTextBoxes = pdp.DocumentText.GetTextTypes(ContentType.TextBox)[0] as TextType; Assert.AreEqual("Word1 Word2", ttTextBoxes.GetChild(0).GetInfo("Content")[0].value); } }