all groups > dotnet xml > april 2005 >
You're in the

dotnet xml

group:

Modifying Excel in DotNet System.Xml


Modifying Excel in DotNet System.Xml tascienu NO[at]SPAM ecoaches.com
4/20/2005 2:41:00 PM
dotnet xml:
Consider the following code...

Open excel document and save it as xml. Try to modify it in vs.net
using the following code...

' ------------------------------
Try
Dim x As New Xml.XmlDocument
x.Load("Book1.xml")
Dim CellNode As Xml.XmlNodeList = x.DocumentElement.ChildNodes
MsgBox(CellNode(0).Name) ' <- this one shows that the first element
is: DocumentProperties....
Dim El As Xml.XmlElement =
x.DocumentElement.SelectSingleNode("DocumentProperties")
MsgBox(El.OuterXml) ' <- this errors because CellEl is nothing...
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try

' -------------------------------

How come i can't select document properties with my xpath, when i just
seen it exists???

Tascien
Re: Modifying Excel in DotNet System.Xml Oleg Tkachenko [MVP]
4/21/2005 12:00:00 AM
[quoted text, click to view]

Most likely an element you want to select is in some excel namespace.
Read about default namespace and XPath.

--
Oleg Tkachenko [XML MVP, MCP]
AddThis Social Bookmark Button