Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i need to create a word document
1- i save the document with the file name in the textbox
2- suppose i save the document name as ABC.docx
3- now i want the final saved document to be saved as ABC_001_A.docx
4- this all i need to do it in C#

I have saved the document like this ABC.docx


But i am not understanding how to save it the this formate ABC_001_A.docx
Posted
Comments
B.Farivar 22-Apr-13 8:24am    
HiYou mean, you want to rename the file automatically with a unique name?
Ajinkya Patil 22-Apr-13 8:26am    
Yes..
Ajinkya Patil 22-Apr-13 8:28am    
What the actuall problem.
I have save the file name which was there in the textbox which is ABC.docx
but i want the final saved document as ABC_001_A.docx
[no name] 22-Apr-13 8:47am    
So get the "ABC" part of the filename and add "_001_A" to it and then save the document. How exactly is this a problem? Showing some code might help clarify your problem.
Ajinkya Patil 22-Apr-13 8:49am    
object saveChanges = true;

oDoc.SaveAs2(doc_code.Text, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

oWord.Quit(ref saveChanges);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900