.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Datatable to word

Posted By: vikas     Posted Date: November 10, 2009    Points:2   Category :ASP.Net
hello
i hav data in data table in asp.net application..i want to fill this data in aform that is made in word document...then i want to take print out of this word document(i don,t want to save)

Responses
Author: Amit Mehra             
Posted Date: November 10, 2009     Points: 5   

HI Vikas,

I did not get the point of putting data into word document when you don't want to prompt user save to client computer?

If you want user to print the document than you can design a web page and you can call the window.print() javascript code to open print dialog.

Let me know that solve your problem or i understood your question correctly..

Thanks
Amit

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: vikas             
Posted Date: November 10, 2009     Points: 5   

HI Amit
sorry i hav a datatable.datatable contain Name,FirstName,LastName,Address,Phone No of a person..i hav form made in Ms word document contain all fields liki table(it just like a form).i want fill data table value in word document form then take print out of that word document(not want to save)......i can attach file but there is no option to attach file
plz reply

Author: Amit Mehra             
Posted Date: November 11, 2009     Points: 5   

Sorry Vikas..What do you mean by "i can attach file but there is no option to attach file"? Are you trying to send mail attachment..I am bit confused here...

Yo have data table and you want user to print the document..The one thing i don't understand why do you want word document?

If you need to create word document you have to call word API to create and put value into it..

Regards
Amit

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Amit Mehra             
Posted Date: November 11, 2009     Points: 5   

HI Vikas,

Another way is to create HTML tag and put then into response object to generate the word file for example

paste this code in any event


string strBody = "<html>" +
"<body>" +
"<div>ID: <b>" + fldCustomerID.Text + "</b></div>" +
"<table width="100%" style="background-color:white;"><tr><td>Customer Id</td><td>+fldCustomerID.Text +</td></tr></table>" +
"</body>" +
"</html>";
Response.AppendHeader("Content-Type", "application/msword");
Response.AppendHeader ("Content-disposition", "attachment; mydoc.doc");
Response.Write(strBody);


Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: vikas             
Posted Date: November 11, 2009     Points: 5   

hello amit
i implement that code..its take print screen of whole page like it also show print in word document.2nd thing it shows download option not print

Author: Amit Mehra             
Posted Date: November 12, 2009     Points: 5   

Hi Vilkas,

you can modify the following line to open word file in asp.net like this

Response.AppendHeader ("Content-disposition", "inline; mydoc.doc");


This will help you...

Regards
Amit

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Peter             
Posted Date: July 28, 2010     Points: 5   

for mail merage from database using asp.net , you can use Spire.Doc, very easy and high performance.
http://www.e-iceblue.com/Introduce/word-for-net-introduce.html
Hope help to you.

Author: Shweta             
Posted Date: February 23, 2011     Points: 5   

m not able to download Spire.doc...
plz provide the setup...
its urgent........

Shweta Agashe
.Net Developer,Global Infobase Solutions.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend