Document Viewer CopyToClipboardCommand

Nov 7, 2011 at 11:50 AM

I have currently implemented a context menu on the document viewer to copy selected text to the clipboard using the CopyToClipboardCommand. 

However when the selected text is copied all formatting (line breaks) is lost and the text is pasted as a single line of text. I've experimented with the textselection object to check for line break characters but had no luck there. Is there any way to capture selected text in the viewer and preserve the line formatting?

Nov 7, 2011 at 6:47 PM


The XPS specification does not include rules for extracting plain text content from XPS documents. Document Toolkit implements a 'best-effort' approach on extracting plain text. This may result in unexpected results and line break characters not being included, simply because they are not found in the original XPS document.

If you send over an XPS document I can take a look and how the text extraction algorithm can be improved.

- Koen