What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 10953 |  Welcome, Guest!   Register  Login
 Home > Forums > C# > Saving word doc in a same folder(c#) ...
Gudevg

Saving word doc in a same folder(c#)

Replies: 2 | Posted by: Gudevg on 4/25/2012 | Category: C# Forums | Views: 551 | Status: [Member] | Points: 10  


Hi all,

I use the below code to add a new document in c#, but i need to develop the code which will generate the document with the same name with extension Document.doc to Documentfig.doc and save it in the same folder of source file.

// Create a new empty document.

DocumentModel document = new DocumentModel();

// Add document content.
document.Sections.Add(
new Section(document,
new Paragraph(document, "Hello World!")));

// Save the document to a file.
document.Save("Document.docx", SaveOptions.DocxDefault);

// Open the document file with Microsoft Word.
Process.Start("Document.docx");


Deepakkumar G.


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Dotnetrajanikanth
Dotnetrajanikanth  
Posted on: 4/25/2012 2:41:00 AM
Level: Starter | Status: [Member] | Points: 25

// Save the document to a file.

document.SaveAs("Documentfig.docx", SaveOptions.DocxDefault);

____________
www.flickr.com/photos/psdesigner/

Gudevg, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Dotnetrajanikanth
Dotnetrajanikanth  
Posted on: 4/25/2012 2:41:32 AM
Level: Starter | Status: [Member] | Points: 50

Resolved

// Save the document to a file.

document.SaveAs("Documentfig.doc", SaveOptions.DocxDefault);

____________
www.flickr.com/photos/psdesigner/

Gudevg, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 9:45:38 PM