Open Word document with WPF without open dialog

I have a path to a Word document saved in an SQL database.

I can get the path, but I cannot find the best approach for opening a Word document from WPF without using OpenFileDialog. I gave up any thoughts on implementing Word in WPF because it has too many fixes.

I just want to be able to click on the button or hyperlink and open Word using the resulting path to the document.

+3
source share
1 answer

Try something like

Process wordProcess = new Process();
wordProcess.StartInfo.FileName = pathToYourDocument;
wordProcess.StartInfo.UseShellExecute = true;
wordProcess.Start();

By setting UseShellExecute to true, it will open the document using the default program, in your case, Word.

+7
source

Source: https://habr.com/ru/post/1743490/


All Articles