public void TestCore() { OPCPackage pkg = PackageHelper.Open( _ssSamples.OpenResourceAsStream("ExcelWithAttachments.xlsm") ); XSSFWorkbook wb = new XSSFWorkbook(pkg); POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(wb); ext.GetText(); // Now check String text = ext.GetText(); String cText = ext.GetCorePropertiesText(); Assert.IsTrue(text.Contains("LastModifiedBy = Yury Batrakov")); Assert.IsTrue(cText.Contains("LastModifiedBy = Yury Batrakov")); }
public void TestWithSomeNulls() { OPCPackage pkg = OPCPackage.Open( _slSamples.OpenResourceAsStream("49386-null_dates.pptx") ); XSLFSlideShow sl = new XSLFSlideShow(pkg); POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(sl); ext.GetText(); String text = ext.GetText(); Assert.IsFalse(text.Contains("Created =")); // With date is null Assert.IsTrue(text.Contains("CreatedString = ")); // Via string is blank Assert.IsTrue(text.Contains("LastModifiedBy = IT Client Services")); }
public void TestExtended() { OPCPackage pkg = OPCPackage.Open( _ssSamples.OpenResourceAsStream("ExcelWithAttachments.xlsm") ); XSSFWorkbook wb = new XSSFWorkbook(pkg); POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(wb); ext.GetText(); // Now check String text = ext.GetText(); String eText = ext.GetExtendedPropertiesText(); Assert.IsTrue(text.Contains("Application = Microsoft Excel")); Assert.IsTrue(text.Contains("Company = Mera")); Assert.IsTrue(eText.Contains("Application = Microsoft Excel")); Assert.IsTrue(eText.Contains("Company = Mera")); }
public void TestGetFromMainExtractor() { OPCPackage pkg = PackageHelper.Open(_ssSamples.OpenResourceAsStream("ExcelWithAttachments.xlsm")); XSSFWorkbook wb = new XSSFWorkbook(pkg); XSSFExcelExtractor ext = new XSSFExcelExtractor(wb); POIXMLPropertiesTextExtractor textExt = ext.GetMetadataTextExtractor(); // Check basics assertNotNull(textExt); Assert.IsTrue(textExt.GetText().Length > 0); // Check some of the content String text = textExt.GetText(); String cText = textExt.GetCorePropertiesText(); Assert.IsTrue(text.Contains("LastModifiedBy = Yury Batrakov")); Assert.IsTrue(cText.Contains("LastModifiedBy = Yury Batrakov")); }
public void TestWithSomeNulls() { OPCPackage pkg = OPCPackage.Open( _slSamples.OpenResourceAsStream("49386-null_dates.pptx") ); XSLFSlideShow sl = new XSLFSlideShow(pkg); POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(sl); ext.GetText(); String text = ext.GetText(); Assert.IsFalse(text.Contains("Created =")); // With date is null Assert.IsTrue(text.Contains("CreatedString = ")); // Via string is blank Assert.IsTrue(text.Contains("LastModifiedBy = IT Client Services")); ext.Close(); }