T
Tim::..
I have a problem with a couple of subs in the code below... Can someone
please help!
It looks like I have declared something wrong but not quite sure...
Please help!
Thanks
.... CODE ...
Imports System.IO
Imports System.Xml
Imports System.Text
Partial Class Dynamic
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
VisioFileNm = "file:///\\FSDKBA051\alhu\Visual Studio
2005\WebSites\DDIAG\blankTest.vdx"
Dim xtr As XmlTextReader = New XmlTextReader(VisioFileNm)
xtr.WhitespaceHandling = WhitespaceHandling.All
VisioXMLDoc.Load(xtr)
xtr.Close()
xtr.Read() '???
RenderVisioDiagram() ' Error
End Sub
Private Property VisioXMLDoc() As XmlDocument
Get
If CType(Session("VisioXMLDoc"), XmlDocument) Is Nothing Then
Session("VisioXMLDoc") = New XmlDocument
End If
Return CType(Session("VisioXMLDoc"), XmlDocument)
End Get
Set(ByVal value As XmlDocument)
Session("VisioXMLDoc") = value
End Set
End Property
Private Property VisioFileNm() As String
Get
Return Session("VisioFileNm").ToString()
End Get
Set(ByVal value As String)
Session("VisioFileNm") = value
End Set
End Property
Private Sub RenderVisioDiagram(ByVal sender As Object, ByVal e As
System.EventArgs)
Application.Lock()
Dim xShapes As XmlNodeList = VisioXMLDoc.GetElementsByTagName("Shape")
For Each xnod As XmlNode In xShapes ChangeShapeAttributes(xnod) '
Error on ChangeShapeAttributes
Application.UnLock()
Dim xtw As XmlTextWriter = New XmlTextWriter(VisioFileNm,
System.Text.UTF8Encoding.UTF8)
VisioXMLDoc.WriteTo(xtw)
xtw.Close()
Next
Dim app As VisioDotNet.Application = New VisioDotNet.ApplicationClass
app.Documents.Open(VisioFileNm)
app.Addons.get_ItemU("SaveAsWeb").Run("/quiet=True
/openbrowser=False /target=" + Request.PhysicalApplicationPath +
"VisioDiagram")
app.Quit()
End Sub
Private Sub ChangeShapeAttribute(ByVal xnod As XmlNode)
Dim strID As String
Dim Attrs As XmlNamedNodeMap
Attrs = xnod.Attributes
strID = Attrs.GetNamedItem("ID").Value.ToString()
Dim xChilds As XmlNodeList
xChilds = xnod.ChildNodes
For Each node As XmlNode In xnod.ChildNodes
If (node.Name = "Fill") Then
For Each fillnode As XmlNode In node.ChildNodes
If fillnode.Name = "FillForegnd" Then
'Change the attribute of the node.
End If
Next
End If
Next
End Sub
End Class
please help!
It looks like I have declared something wrong but not quite sure...
Please help!
Thanks
.... CODE ...
Imports System.IO
Imports System.Xml
Imports System.Text
Partial Class Dynamic
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
VisioFileNm = "file:///\\FSDKBA051\alhu\Visual Studio
2005\WebSites\DDIAG\blankTest.vdx"
Dim xtr As XmlTextReader = New XmlTextReader(VisioFileNm)
xtr.WhitespaceHandling = WhitespaceHandling.All
VisioXMLDoc.Load(xtr)
xtr.Close()
xtr.Read() '???
RenderVisioDiagram() ' Error
End Sub
Private Property VisioXMLDoc() As XmlDocument
Get
If CType(Session("VisioXMLDoc"), XmlDocument) Is Nothing Then
Session("VisioXMLDoc") = New XmlDocument
End If
Return CType(Session("VisioXMLDoc"), XmlDocument)
End Get
Set(ByVal value As XmlDocument)
Session("VisioXMLDoc") = value
End Set
End Property
Private Property VisioFileNm() As String
Get
Return Session("VisioFileNm").ToString()
End Get
Set(ByVal value As String)
Session("VisioFileNm") = value
End Set
End Property
Private Sub RenderVisioDiagram(ByVal sender As Object, ByVal e As
System.EventArgs)
Application.Lock()
Dim xShapes As XmlNodeList = VisioXMLDoc.GetElementsByTagName("Shape")
For Each xnod As XmlNode In xShapes ChangeShapeAttributes(xnod) '
Error on ChangeShapeAttributes
Application.UnLock()
Dim xtw As XmlTextWriter = New XmlTextWriter(VisioFileNm,
System.Text.UTF8Encoding.UTF8)
VisioXMLDoc.WriteTo(xtw)
xtw.Close()
Next
Dim app As VisioDotNet.Application = New VisioDotNet.ApplicationClass
app.Documents.Open(VisioFileNm)
app.Addons.get_ItemU("SaveAsWeb").Run("/quiet=True
/openbrowser=False /target=" + Request.PhysicalApplicationPath +
"VisioDiagram")
app.Quit()
End Sub
Private Sub ChangeShapeAttribute(ByVal xnod As XmlNode)
Dim strID As String
Dim Attrs As XmlNamedNodeMap
Attrs = xnod.Attributes
strID = Attrs.GetNamedItem("ID").Value.ToString()
Dim xChilds As XmlNodeList
xChilds = xnod.ChildNodes
For Each node As XmlNode In xnod.ChildNodes
If (node.Name = "Fill") Then
For Each fillnode As XmlNode In node.ChildNodes
If fillnode.Name = "FillForegnd" Then
'Change the attribute of the node.
End If
Next
End If
Next
End Sub
End Class