use of org.apache.poi.xdgf.usermodel.XmlVisioDocument in project poi by apache.
the class XDGFFileHandler method test.
// a test-case to test this locally without executing the full TestAllFiles
@Test
public void test() throws Exception {
OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ);
try {
XmlVisioDocument doc = new XmlVisioDocument(pkg);
new POIXMLDocumentHandler().handlePOIXMLDocument(doc);
} finally {
pkg.close();
}
}
use of org.apache.poi.xdgf.usermodel.XmlVisioDocument in project poi by apache.
the class HierarchyPrinter method main.
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println("Usage: in.vsdx outdir");
System.exit(1);
}
String inFilename = args[0];
String outDir = args[1];
XmlVisioDocument doc = new XmlVisioDocument(new FileInputStream(inFilename));
printHierarchy(doc, outDir);
}
use of org.apache.poi.xdgf.usermodel.XmlVisioDocument in project poi by apache.
the class VsdxToPng method main.
public static void main(String[] args) throws Exception {
if (args.length > 2) {
System.err.println("Usage: [--debug] in.vsdx outdir");
System.exit(1);
}
ShapeRenderer renderer = new ShapeRenderer();
String inFilename = args[0];
String pngDir = args[1];
if (args[0].equals("--debug")) {
inFilename = args[1];
pngDir = args[2];
renderer = new ShapeDebuggerRenderer();
}
XmlVisioDocument doc = new XmlVisioDocument(new FileInputStream(inFilename));
renderToPng(doc, pngDir, 2000 / 11.0, renderer);
}
use of org.apache.poi.xdgf.usermodel.XmlVisioDocument in project poi by apache.
the class TestXDGFVisioExtractor method testPolylineTo.
/**
* Some confusion on PolylineTo vs PolyLineTo, both should be handled.
* Previously failed with:
* org.apache.poi.POIXMLException: Invalid 'Row_Type' name 'PolylineTo'
* at org.apache.poi.xdgf.util.ObjectFactory.load
* at org.apache.poi.xdgf.usermodel.section.geometry.GeometryRowFactory.load
*/
@Test
public void testPolylineTo() throws IOException {
InputStream is = SAMPLES.openResourceAsStream("60973.vsdx");
XmlVisioDocument document = new XmlVisioDocument(is);
is.close();
XDGFVisioExtractor extractor = new XDGFVisioExtractor(document);
String text = extractor.getText();
assertContains(text, "42 U");
assertContains(text, "Access VLANS");
extractor.close();
}
use of org.apache.poi.xdgf.usermodel.XmlVisioDocument in project poi by apache.
the class XDGFFileHandler method handleFile.
@Override
public void handleFile(InputStream stream, String path) throws Exception {
// ignore password protected files
if (POIXMLDocumentHandler.isEncrypted(stream))
return;
XmlVisioDocument doc = new XmlVisioDocument(stream);
new POIXMLDocumentHandler().handlePOIXMLDocument(doc);
}
Aggregations