I want to create the file with customer specified filename with specified extension
ex: sample.xlsx or sample.docx or sample.txt
and need to open it. i have used the below sample code and which is created and open the txt format files as expected but other format files such as (.xlsx,.doc) are created but which throws error
"file cannot open and specified file format and extension is invalid"
while trying to open the created file.
var hyperLink = new Hyperlink();
FileStream file = new FileStream(@Hyperlink.Address,
FileMode.Create);
hyperLink.NavigateUri = new Uri(file.Name);
file.Close();
if (hyperLink.NavigateUri != null)
Process.Start(new ProcessStartInfo(hyperLink.NavigateUri.AbsoluteUri));