Recently, i created a webservice to generate the word and excel files using Office Open XML.
The Open XML SDK can be downloaded from http://www.microsoft.com/downloads/details.aspx?familyid=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&displaylang=en
Use the following namespaces
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
Code sample :
using (WordprocessingDocument wordDoc = WordprocessingDocument.Create(@"d:\doc\hello.docx", WordprocessingDocumentType.Document))
{
MainDocumentPart part = wordDoc.AddMainDocumentPart();
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
sb.Append("<w:document xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">");
sb.Append("<w:body><w:p><w:r><w:t>Hello world!</w:t></w:r></w:p></w:body>");
sb.Append("</w:document>");
using (Stream stream = part.GetStream())
{
byte[] buf = (new UTF8Encoding()).GetBytes(sb.ToString());
stream.Write(buf, 0, buf.Length);
}
}