We are creating an application which will allow users to read and display 3rd party files such as Word Documents, HTML files, PDF documents and spreadsheets.
We intend to implement this functionality by:
- converting 3rd party files to XPS documents.
- using WPF’s DocumentViewer control to display the resulting XPS document in our application.
- using a custom template to hide the DocumentViewer’s ToolBar and FindToolBar.
This works fine, however, using our application users should also be to:
- highlight text in 3rd party files and launch commands in relation to the highlighted text.
- find words and phrases in 3rd party files, with a GUI that is part of our application and not part of the DocumentViewer window.
These requirements are more challenging because:
1. TextSelection is not exposed on the DocumentViewer control. There is no programmatic way to get or select the currently selected text.
2. The DocumentViewer control does not provide a public API for its Find functionality.
3. WPF does not provide a public API for finding text inside FixedDocuments.
Are any of the issues (1 to 3) listed above likely to be addressed a future release of WPF?