2013-04-08

View Office documents in WPF Application

Well. The answer is DocumentView WPF control.


  1. First the office document should be converted to XPS type document. Please look at this post.
  2. Then bind it to the Document property of the DocumentViewer control.
XAML

<DocumentViewer Name="myDocumentViewer" Margin="0,0,0,59">

</DocumentViewer>

And code behind;

myDocumentViewer.Document = this.ConvertOfficeDocToXPSDoc(this.FileName, this.newXPSDocumentName).GetFixedDocumentSequence();

That's all you need to do.