I am working on a web application which creates the Visio diagram depending upon the data in the database.
Depending upon the data, different rectangular boxes are created and connected with the help of dynamic connector.
I have added some information on the text property of the dynamic connector,But by default it get sets in the middle of the connector.
I want to reposition this text dynamically in the beginning of the connector shape not in the middle.
Can somebody please help me in doing this as i am fully stuck with this problem?
I am posting my code which i am using to connect to the shapes.
private void connectWithDynamicGlueAndConnector(Shape shapeFrom, Shape shapeTo, Page currentPage, Box box)
{
Microsoft.Office.Interop.Visio.Cell beginXCell;
Microsoft.Office.Interop.Visio.Cell endXCell;
Microsoft.Office.Interop.Visio.Shape connector;
try
{
// Add a Dynamic connector to the page. //.FlowchartStencil
connector = dropMasterOnPage(
(Page)shapeFrom.ContainingPage,
"Dynamic Connector",
Utilities.FlowchartStencil, 1.0, 1.0);
//Added on 10/03/2011 for tooltip
connector.get_CellsSRC((short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionObject,
(short)Microsoft.Office.Interop.Visio.VisRowIndices.visRowMisc,
(short)Microsoft.Office.Interop.Visio.VisCellIndices.visComment).FormulaU = "\"" + box.InterfaceInfo + "\"";
connector.get_CellsU("LineWeight").FormulaU = "2pt";
connector.get_CellsU("LineColor").Formula = arrowColor;//"RGB(255, 0, 0)";
// Connect the begin point.
beginXCell = connector.get_CellsSRC(
(short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D,
(short)VisCellIndices.vis1DBeginX);
beginXCell.GlueTo(shapeFrom.get_CellsSRC(
(short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXFormOut,
(short)VisCellIndices.visXFormPinX));
// Connect the end point.
endXCell = connector.get_CellsSRC(
(short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D,
(short)VisCellIndices.vis1DEndX);//
// Connect the end point.
endXCell.GlueTo(shapeTo.get_CellsSRC(
(short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXFormOut,
(short)VisCellIndices.visXFormPinX));//
Cell arrowCellBegin = connector.get_CellsSRC((short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionObject, (short)Microsoft.Office.Interop.Visio.VisRowIndices.visRowLine,
(short)Microsoft.Office.Interop.Visio.VisCellIndices.visLineBeginArrow);
if (box.blBoxType)
arrowCellBegin.FormulaU = "5";
Cell arrowCell = connector.get_CellsSRC((short)Microsoft.Office.Interop.Visio.VisSectionIndices.visSectionObject, (short)Microsoft.Office.Interop.Visio.VisRowIndices.visRowLine,
(short)Microsoft.Office.Interop.Visio.VisCellIndices.visLineEndArrow);
if (!box.blBoxType)
arrowCell.FormulaU = "5";
connector.Text = box.InterfaceDetails;
}
catch (Exception ex)
{
objErrorLog.ErrorLog(ex.Message);
}
finally
{
beginXCell = null;
endXCell = null;
connector = null;
}
}
Thanks
Dinesh