Reputation: 47
I am using office automation to convert visio files to a specified xml format flowchart, and I need use the swimlane data as container of workflow process . so how can I get the relation between workflow shapes and swimlane ?
CODE
IVisio.Shape shape = o as IVisio.Shape;
double width = shape.Cells["Width"]
.Result[Microsoft.Office.Interop.Visio.VisUnitCodes.visMillimeters];
double height = shape.Cells["Height"]
.Result[Microsoft.Office.Interop.Visio.VisUnitCodes.visMillimeters];
double pinX = shape.Cells["PinX"]
.Result[Microsoft.Office.Interop.Visio.VisUnitCodes.visMillimeters];
double pinY = shape.Cells["PinY"]
.Result[Microsoft.Office.Interop.Visio.VisUnitCodes.visMillimeters];
Upvotes: 1
Views: 2014
Reputation: 1
You create the XML document with the data for the PackagePart. You need to pay special attention to the XML namespaces that govern the schema for the specific type of XML document that you create. You create a new file to contain the XML and save the file to a location in the Package. You create the necessary relationships between the new PackagePart and the Package or other PackagePart objects. You update any existing parts that need to reference the new part. For example, if you add a new Page Contents part (a new page) to the file, you also need to update the Page Index part (/visio/pages/pages.xml file) to include the correct information about the new page.
Upvotes: -1
Reputation: 47
To find the container relation can use the API with this method:
public class ShapeWrapper
{
public IVisio.Shape Shape { get; set; }
private List<ShapeWrapper> children = new List<ShapeWrapper>();
public List<ShapeWrapper> Children { get { return this.children; } }
public ShapeWrapper(IVisio.Shape shape)
{
Shape = shape;
}
}
private void FindChildren(ShapeWrapper shapeWrapper,
List<IVisio.Shape> addedShapes)
{
IVisio.Selection children = shapeWrapper
.Shape.SpatialNeighbors[
(short)IVisio.VisSpatialRelationCodes.visSpatialContain,
0,
(short)IVisio.VisSpatialRelationFlags.visSpatialFrontToBack];
foreach (IVisio.Shape child in children)
{
if (!addedShapes.Contains(child))
{
//MessageBox.Show(child.Text);
ShapeWrapper childWrapper = new ShapeWrapper(child);
shapeWrapper.Children.Add(childWrapper);
FindChildren(childWrapper, addedShapes);
}
}
}
Upvotes: 0
Reputation: 1500
Return IDs of shapes that are associated with both incoming and outgoing connections.
using Visio = Microsoft.Office.Interop.Visio;
visioObj = (Visio.Application)
System.Runtime.InteropServices.Marshal.GetActiveObject("Visio.Application");
Array ids = shape.ConnectedShapes(Visio.VisConnectedShapesFlags
.visConnectedShapesAllNodes, "");
// Using first item and get name
string name = visioObj.ActivePage.Shapes[ids.GetValue(0)].Name;
Upvotes: 2