Question

I'm writing a visio export and created a visio template file containing custom line endings. When I try to set those using code, it is not working.

    //Create two shapes
    final IVMaster lApp = stencilObj.masters("Application");
    IVShape shapeFrom = pagObj.drop(lApp, 1, 1);
    IVShape shapeTo = pagObj.drop(lApp, 2, 3);

    //Connect the shapes
    final IVMaster connMaster = stencilObj.masters("Connection");
    IVShape connection = pagObj.drop(connMaster, 2, 3);
    final IVCell gluefrom1 = connection.cells("BeginX");
    final IVCell glueat1 = shapeFrom.cells("PinX");
    gluefrom1.glueTo(glueat1);

    final IVCell gluefrom2 = connection.cells("EndX");
    final IVCell glueat2 = shapeTo.cells("PinX");
    gluefrom2.glueTo(glueat2);

    //Set arrow ending
    connection.cellsU("EndArrow").formulaForceU(new Integer(46).toString());

So there are 45 default line endings in visio and the 46th in the list is mine. When I'm setting number 45 it works, number 46 doesn't. When I right click on the connection and go to Format->Line, the correct line ending is selected and the Preview is also correct. I have to select the ending again and click apply for it to be updated in the document.

I'm working with Visio 2007

Was it helpful?

Solution

Ok I found the problem. You need to use the full name for the line ending and call a visio function with it.

 //Set arrow ending
 connection.cellsU("EndArrow").formula("=USE(\"46: interface_in\")");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top