Use XProcessingInstruction
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Reflection;
using System.Xml.Linq;
class Program {
static void Main(string[] args) {
XNamespace w = "http://schemas.microsoft.com/office/word/2003/wordml";
XDocument word = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XProcessingInstruction("mso-application", "progid=\"Word.Document\""),
new XElement(w + "wordDocument",
new XAttribute(XNamespace.Xmlns + "w", w.NamespaceName)));
System.IO.StringWriter sw = new System.IO.StringWriter();
word.Save(sw);
Console.WriteLine(sw);
}
}
Related examples in the same category