C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Please help me


Posted Date: 18 Feb 2008      Total Responses: 2

Posted By: lalli       Member Level: Gold     Points: 2


How to create the .doc file ,
please send code to me.
i am using windows application.




Responses

Author: Giribabu    18 Feb 2008Member Level: GoldRating:     Points: 2
To create a word document using C# we need to first reference the following DLL(com)
<b>Microsoft Word 11.0 Object Library</b>


After adding reference, add this directive

using Microsoft.Office.Interop.Word;

Put this code on button click

object missing = System.Reflection.Missing.Value;
object Visible=true;
object start1 = 0;
object end1 = 0;
ApplicationClass WordApp = new ApplicationClass();
Document adoc = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng=adoc.Range(ref start1,ref missing);
rng.Font.Name=”Georgia”;
rng.InsertAfter(”Hello World!”);
object filename = @”C:\MyWord.doc”;
adoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible=true;



Author: karthik    18 Feb 2008Member Level: DiamondRating:     Points: 2
http://www.dotnetspider.com/code/C-1150-Create-New-WordDocument-using-VB-Net.aspx


Post Reply
You must Sign In to post a response.
Next : how can get the dynamic value in the client side javascript
Previous : Windows Application Datagrid (multiple row delete)
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

silicone halloween mask

Contact Us    Privacy Policy    Terms Of Use