Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a Word Addin which opens a Windows Form. On submitting the form it will create a XML. I want to save the word with the same name as the XML document. The name will have a GUID. I want to save the XML first then the word.

Save Format ->
<aaa>_<doctype>_<guid>.xml
<aaa>_<doctype>_<guid>.docx
aaa=companycode (data is available in the windows form),
doctype=document type of the doc(data is available in the windows form),

Please advise..

What I have tried:

Successfully able to save the XML.
Posted
Updated 13-Sep-18 9:17am

1 solution

Path.ChangeExtension(String, String) Method (System.IO) | Microsoft Docs[^]
C#
string documentFileName = Path.ChangeExtension(xmlFileName, ".docx");
 
Share this answer
 
Comments
Maciej Los 14-Sep-18 4:34am    
This method changes only file extension, but it seems to meet OP's criteria ;)
5ed!

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