Reputation: 20232
I wanna insert in second line :
<?mso-application progid="Excel.Sheet"?>
but I'm started to think that it is impossible.
Here is my base code:
XmlDocument doc = new XmlDocument();
XmlReader reader = cmd.ExecuteXmlReader();
doc.LoadXml("<results></results>");
XmlNode newNode = doc.ReadNode(reader);
while (newNode != null)
{
doc.DocumentElement.AppendChild(newNode);
newNode = doc.ReadNode(reader);
}
Upvotes: 0
Views: 485
Reputation: 14662
Just Try like this
XmlNode XNode = doc.CreateProcessingInstruction("mso-application ", "progid=\"Excel.Sheet\"");
doc.AppendChild(XNode);
Upvotes: 2
Reputation: 32651
<?mso-application progid="Excel.Sheet"?>
is a processing instruction not an element so you need to use the CreateProcessingInstruction Method
Upvotes: 2