How to merge my content with a existing word document.
-
Hi all, I have an scenario, I have to merge some dynamic content (to say data retrived from DB) in an existing word document without losing the existing content in that document. So that when ever there is a new conent, i use the same word document file and append my content. Please suggest me how to do this, else provide me some URL to learn and do using C#. Thanks in advance
Know is Drop, Unknown is Ocean
-
Hi all, I have an scenario, I have to merge some dynamic content (to say data retrived from DB) in an existing word document without losing the existing content in that document. So that when ever there is a new conent, i use the same word document file and append my content. Please suggest me how to do this, else provide me some URL to learn and do using C#. Thanks in advance
Know is Drop, Unknown is Ocean
Following code will help you..
StringBuilder strBuilder = newStringBuilder();
strBuilder.Append("<h1 title='Header' align='Center'>Writing To Word Using ASP.NET</h1> ".ToString());
strBuilder.Append("<br>".ToString());
strBuilder.Append("<table align='Center'>".ToString());
strBuilder.Append("<tr>".ToString());
strBuilder.Append("<td style='width:100px;color:green'><b>amiT</b></td>".ToString());
strBuilder.Append("<td style='width:100px;color:red'>India</td>".ToString());
strBuilder.Append("</tr>".ToString());
strBuilder.Append("</table>".ToString());
// string strPath = Request.PhysicalApplicationPath + "\\document\\Test.doc";
string strPath = filename;
//string strTextToWrite = TextBox1.Text;
FileStream fStream = newFileStream (strPath,FileMode.Append);
fStream.Close();
StreamWriter sWriter = newStreamWriter(strPath);
sWriter.Write(strBuilder);
sWriter.Close();Find following links for more help... http://www.daniweb.com/forums/thread210396.html[^] http://devpinoy.org/blogs/keithrull/archive/2007/05/23/how-to-merge-multiple-microsoft-word-documents-in-c.aspx[^] http://csharpdotnetfreak.blogspot.com/2009/06/read-write-word-filestream-streamwriter.html[^] HTH
Jinal Desai - LIVE Experience is mother of sage....