use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class DrawingDump method main.
public static void main(String[] args) throws IOException {
OutputStreamWriter osw = new OutputStreamWriter(System.out, Charset.defaultCharset());
PrintWriter pw = new PrintWriter(osw);
NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(args[0]));
HSSFWorkbook wb = new HSSFWorkbook(fs);
try {
pw.println("Drawing group:");
wb.dumpDrawingGroupRecords(true);
int i = 1;
for (Sheet sheet : wb) {
pw.println("Sheet " + i + "(" + sheet.getSheetName() + "):");
((HSSFSheet) sheet).dumpDrawingRecords(true, pw);
}
} finally {
wb.close();
fs.close();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class TestXSLFSlideShowFactory method createProtected.
private static File createProtected(String basefile, String password) throws IOException, GeneralSecurityException {
NPOIFSFileSystem fs = new NPOIFSFileSystem();
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);
Encryptor enc = info.getEncryptor();
enc.confirmPassword(password);
InputStream fis = _slTests.openResourceAsStream(basefile);
OutputStream os = enc.getDataStream(fs);
IOUtils.copy(fis, os);
os.close();
fis.close();
File tf = TempFile.createTempFile("test-xslf-slidefactory", ".pptx");
FileOutputStream fos = new FileOutputStream(tf);
fs.writeFilesystem(fos);
fos.close();
fs.close();
return tf;
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class SlideShowDumper method main.
/**
* right now this function takes one parameter: a ppt file, and outputs
* a dump of what it contains
*/
public static void main(String[] args) throws IOException {
if (args.length == 0) {
System.err.println("Useage: SlideShowDumper [-escher|-basicescher] <filename>");
return;
}
String filename = args[0];
if (args.length > 1) {
filename = args[1];
}
NPOIFSFileSystem poifs = new NPOIFSFileSystem(new File(filename));
SlideShowDumper foo = new SlideShowDumper(poifs, System.out);
poifs.close();
if (args.length > 1) {
if (args[0].equalsIgnoreCase("-escher")) {
foo.setDDFEscher(true);
} else {
foo.setBasicEscher(true);
}
}
foo.printDump();
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class HSMFDump method main.
public static void main(String[] args) throws Exception {
for (String file : args) {
NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(file), true);
HSMFDump dump = new HSMFDump(fs);
dump.dump();
fs.close();
}
}
use of org.apache.poi.poifs.filesystem.NPOIFSFileSystem in project poi by apache.
the class TestPOIDocumentScratchpad method testWriteProperties.
@Test
public void testWriteProperties() throws IOException {
// Just check we can write them back out into a filesystem
NPOIFSFileSystem outFS = new NPOIFSFileSystem();
doc.writeProperties(outFS);
// Should now hold them
assertNotNull(outFS.createDocumentInputStream("\005SummaryInformation"));
assertNotNull(outFS.createDocumentInputStream("\005DocumentSummaryInformation"));
outFS.close();
}
Aggregations