converting Org chart child nodes from vertical into horizontal in code

M

memo lob

Dear all =

I'm working in generating and organization chart from database and =

everything is worked very well but the result that I get keep draw the child =

nodes in vertical rather than horizontal. and I need to presant the child =

nodes in horizontal way to minimize the page width size. =

i have been used the following code to do it, do i need to change somthing =

on it or do i have another way to code it. =

i'm using microsoft visio 2003 and i code it by VB.Net and i'm exporting the =

result into HTML page =


______________________________________________________________ =


Dim objVisio As Visio.Application =


Dim objAddOn As Visio.Addon =


Dim pagObj As Visio.Page =


Dim shpObj As Visio.Shape =


Dim celObjHeight As Visio.Cell =


Dim celObjWidth As Visio.Cell =


Dim vsoSaveAsWeb As VisSaveAsWeb =


Dim vsoWebSettings As VisWebPageSettings =


Dim strCommand As String =


Dim i As Integer =




strCommand =3D "/DATASOURCE=3D (your ODBC datasource name) ,TABLE=3D" _ =


& " (your table name) , DBQUALIFIER=3D (your database name)" _ =


& " /NAME-FIELD=3D (enter the name field)" _ =


& " /UNIQUEID-FIELD=3D (the master field)" _ =


& " /MANAGER-FIELD=3D (the reporting to field)" _ =


& " /DISPLAY-FIELDS=3D (enter the master fields (field1, field2,field 3,..))" _ =


& " /CUSTOM-PROPERTY-FIELDS=3D ( enter the custom fields (field1, field2,field =

3,..)" _ =


& " /SHAPE-FIELD=3DMASTER_SHAPE" =




=E2=80=98create the visio chart in silent mode =


objVisio =3D New Visio.InvisibleApp =


=E2=80=98generate the organization chart wizard =


objAddOn =3D objVisio.Addons.ItemU("OrgCWiz") =




'Run the add-on (errors are handled by the add-on) =


On Error Resume Next =




'Break up the string =


Dim strCommandPart As String =


Dim strCommandLeft As String =


strCommandLeft =3D strCommand =


objAddOn.Run("/S-INIT") =


While (Len(strCommandLeft) > 0) =


strCommandPart =3D Microsoft.VisualBasic.Left(strCommandLeft, =

MAX_ARGSTRING_LENGTH) =


strCommandLeft =3D Mid(strCommandLeft, Len(strCommandPart) + 1) =


objAddOn.Run("/S-ARGSTR " + strCommandPart) =


End While =


objAddOn.Run("/S-RUN " + strCommandLeft) =




vsoSaveAsWeb =3D objVisio.Application.SaveAsWebObject =


' Get a VisWebPageSettings object. =


vsoWebSettings =3D vsoSaveAsWeb.WebPageSettings =


' Configure preferences. =


With vsoWebSettings =


..StartPage =3D 1 =


..EndPage =3D 2 =


..QuietMode =3D True =


..TargetPath =3D "(set the uotput path) : C:\result.htm" =


..SilentMode =3D True =


End With =




pagObj =3D objVisio.ActivePage =




=E2=80=98 resize the shaps to fit with it text =


For i =3D 0 To pagObj.Shapes.Count =


If pagObj.Shapes.Item(i).Name.Contains("Executive") Or =

pagObj.Shapes.Item(i).Name.Contains("Manager") Or =

pagObj.Shapes.Item(i).Name.Contains("Position") Then =


pagObj.Shapes.Item(i).CellsSRC(1, 1, 1).FormulaForceU =3D "9.15625 in" =


pagObj.Shapes.Item(i).CellsSRC(1, 1, 3).FormulaForceU =3D "1.6875 in" =


End If =


Next i =




'redrow the organization chart =




Dim placeStyleCell As Microsoft.Office.Interop.Visio.Cell =


Dim routeStyleCell As Microsoft.Office.Interop.Visio.Cell =




' Automatically layout the shapes. =


placeStyleCell =3D pagObj.PageSheet.CellsSRC( _ =


CShort(Microsoft.Office.Interop.Visio.VisSectionIndices. _ =


visSectionObject), _ =


CShort(Microsoft.Office.Interop.Visio.VisRowIndices. _ =


visRowPageLayout), _ =


CShort(Microsoft.Office.Interop.Visio.VisCellIndices. _ =


visPLOPlaceDepth)) =




routeStyleCell =3D pagObj.PageSheet.CellsSRC( _ =


CShort(Microsoft.Office.Interop.Visio.VisSectionIndices. _ =


visSectionObject), _ =


CShort(Microsoft.Office.Interop.Visio.VisRowIndices. _ =


visRowPageLayout), _ =


CShort(Microsoft.Office.Interop.Visio.VisCellIndices. _ =


visPLORouteStyle)) =




placeStyleCell.Result(Microsoft.Office.Interop.Visio. _ =


VisUnitCodes.visPageUnits) =3D _ =



CDbl(Microsoft.Office.Interop.Visio.VisCellVals.visPLOPlaceTopToBottom)=
=




routeStyleCell.Result(Microsoft.Office.Interop.Visio. _ =


VisUnitCodes.visPageUnits) =3D _ =


CDbl(Microsoft.Office.Interop.Visio.VisCellVals. _ =


visLORouteOrgChartWE) =




pagObj.Layout() =




pagObj.CenterDrawing() =




=E2=80=98generate the chart =


vsoSaveAsWeb.CreatePages() =


=E2=80=98save it as a web =


objVisio.ActiveDocument.Saved =3D True =


objVisio.ActiveDocument.Close() =


objAddOn =3D Nothing =


objVisio.Quit() =


objVisio =3D Nothing =


thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top