Saving word doc in a same folder(c#) [Resolved]

Posted by Gudevg under C# on 4/25/2012 | Points: 10 | Views : 3747 | Status : [Member] | Replies : 3
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.


Responses

Posted by: Dotnetrajanikanth on: 4/25/2012 [Member] Starter | Points: 50

Up
0
Down

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. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/25/2012 [Member] Starter | Points: 25

Up
0
Down
// 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. | Alert Moderator

Posted by: Arronlee on: 5/15/2014 [Member] Starter | Points: 25

Up
0
Down
I am testing the related Word Doc processor(http://www.yiigo.com/guides/csharp/how-to-process-word.shtml ) these days. I wiil check it whether it allows Word doc saving project later.

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

Login to post response