本文整理汇总了C#中Workshare.Fcs.Lite.OfficeOpenXML.PptxDocumentProcessor.Process方法的典型用法代码示例。如果您正苦于以下问题:C# PptxDocumentProcessor.Process方法的具体用法?C# PptxDocumentProcessor.Process怎么用?C# PptxDocumentProcessor.Process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workshare.Fcs.Lite.OfficeOpenXML.PptxDocumentProcessor
的用法示例。
在下文中一共展示了PptxDocumentProcessor.Process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPassthroughPptxDocumentEmptyPresentation
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);
}
}
示例2: TestCleanPptxDocumentWithFields_ActuallyOLEObjects
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);
}
}
示例3: TestPassthroughPptxDocumentWithHiddenSlides
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);
}
}
示例4: TestDiscoverPptmComments
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);
}
}
示例5: Read
public override DocumentText Read()
{
using (PptxDocumentProcessor dp = new PptxDocumentProcessor(m_data.AsStream()))
{
dp.Process(DocumentProcessingActions.Discover);
return dp.DocumentText;
}
}
示例6: CleanTo
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();
}
}
示例7: TestSorting_SlideOrder
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);
}
}
示例8: TestDiscoverPptxHiddenSlides
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);
}
}
示例9: TestHiddenSlideLookupByTargetName
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);
}
}
示例10: TestHiddenSlideLookup
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);
}
}
示例11: TestDiscoverHyperlinksInDiagrams
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)");
}
}
示例12: TestDiscoverPptxDocumentStatistics
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);
}
}
示例13: TestDiscoverContentWithBrTags
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);
}
}
示例14: TestDiscoverDiagrams
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");
}
}
示例15: TestDiscoverPptmDocumentWithCustomProperties
public void TestDiscoverPptmDocumentWithCustomProperties()
{
string TEST_PPT = TESTFILE_DIR + "test020.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 ttCustProps = pdp.DocumentText.GetTextTypes(ContentType.CustomProperty)[0] as TextType;
Assert.IsNotNull(ttCustProps);
Assert.AreEqual(2, ttCustProps.GetChildCount());
Assert.AreEqual("ITooAmACustProp", ttCustProps.GetChild(0).GetInfo("Name")[0].value);
Assert.AreEqual("Unlike my friend you can see me", ttCustProps.GetChild(0).GetInfo("Value")[0].value);
Assert.AreEqual("_IamACustomProperty", ttCustProps.GetChild(1).GetInfo("Name")[0].value);
Assert.AreEqual("Hiddid texty stuff", ttCustProps.GetChild(1).GetInfo("Value")[0].value);
}
}