Search in sources :

Example 1 with XmlVisioDocument

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();
    }
}
Also used : XmlVisioDocument(org.apache.poi.xdgf.usermodel.XmlVisioDocument) OPCPackage(org.apache.poi.openxml4j.opc.OPCPackage) Test(org.junit.Test)

Example 2 with XmlVisioDocument

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);
}
Also used : XmlVisioDocument(org.apache.poi.xdgf.usermodel.XmlVisioDocument) FileInputStream(java.io.FileInputStream)

Example 3 with XmlVisioDocument

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);
}
Also used : ShapeDebuggerRenderer(org.apache.poi.xdgf.usermodel.shape.ShapeDebuggerRenderer) XmlVisioDocument(org.apache.poi.xdgf.usermodel.XmlVisioDocument) ShapeRenderer(org.apache.poi.xdgf.usermodel.shape.ShapeRenderer)

Example 4 with XmlVisioDocument

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();
}
Also used : InputStream(java.io.InputStream) XmlVisioDocument(org.apache.poi.xdgf.usermodel.XmlVisioDocument) Test(org.junit.Test)

Example 5 with XmlVisioDocument

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);
}
Also used : XmlVisioDocument(org.apache.poi.xdgf.usermodel.XmlVisioDocument)

Aggregations

XmlVisioDocument (org.apache.poi.xdgf.usermodel.XmlVisioDocument)7 Test (org.junit.Test)3 InputStream (java.io.InputStream)2 FileInputStream (java.io.FileInputStream)1 OPCPackage (org.apache.poi.openxml4j.opc.OPCPackage)1 ShapeDebuggerRenderer (org.apache.poi.xdgf.usermodel.shape.ShapeDebuggerRenderer)1 ShapeRenderer (org.apache.poi.xdgf.usermodel.shape.ShapeRenderer)1 Before (org.junit.Before)1