2025 AI Readiness Report: Survey Insights on Enterprise AI Maturity – Now Available!

How to Display MS Office Files on Xamarin.Forms

By Shirley Gong | 2018 Nov 02

Sanity Image
Read time

3 min

It's possible to display Office documents in a Xamarin app without using a server, Microsoft Office license, or other third-party software. The Apryse Office PDF SDK converts Office files to PDF directly in the client, with no dependencies.

This tutorial walks you through how to do this on Xamarin.Android, Xamarin.iOS, and Xamarin.UWP.

If you are interested in trying this out for yourself you can download our trial.

Let's begin!

Part 1 - Using Xamarin.Android

Copied to clipboard

Office files are converted to PDF before viewing, but we can stream the file as the conversion happens so users can see and interact with the document almost instantly:

Here's what it looks like:

Viewing an Office document in a Xamarin Android viewer

If you need to perform batch conversions without displaying the PDF, this can be separated into two discrete steps. Here's how to convert Office files to PDF without displaying/streaming:

And then if you just want to display the PDF:

The Apryse Xamarin PDF library also supports converting many other formats to PDF for display, like images (.jpeg, .jpg, .gif, .png, .bmp etc.), markdown (.md) or comic book archive (.cbz). Here's how:

You can then view these converted files in the same way as the PDF.

Learn more about converting Excel, Word, PPT to PDF in Xamarin.Android, or get started with our SDK by downloading a free trial.

Part 2 - Using Xamarin.iOS

Copied to clipboard

Next, we'll show you how to do this on Xamarin.iOS. The first thing we need to do is to convert the Office document to PDF, like so:

Once converted to PDF, we can display it:

Here's what it looks like:

Blog image

If you'd like to support other file formats in Xamarin.iOS, you can convert them:

These converted files can now be viewed in the same way as the PDF.

Learn more about converting Excel, Word, PPT to PDF in Xamarin.iOS, or get started with our SDK by downloading a free trial.

Part 3 - Xamarin.UWP

Copied to clipboard

Just like with Xamarin.Android, the UWP Office-to-PDF conversion process on can be streamed so users can see and interact with the document almost instantly:

Here's what it looks like:

Image of streaming a file using an Office PDF SDK

Here's how to convert Office documents to PDF without the display step:

If you just want to display the PDF:

And here's how to convert other file formats in Xamarin.UWP to PDF:

These converted files can now be viewed in the same way as the PDF.

Learn more about converting and viewing Microsoft Office files in UWP, or get started with our Office PDF SDK by downloading a free trial.

Adding More Functionality

Copied to clipboard

For a richer document experience, the Apryse Xamarin PDF library makes it easy to add more functionality to the viewer:

Conclusion

Copied to clipboard

Adding an Office document viewer to your Xamarin app is simple with the Apryse SDK. To give it a try, download a free trial and check out our Xamarin.Android, Xamarin.iOS, and Xamarin.UWP documentation.

For further guidance, please feel free to check out our comprehensive SDK Buying Guide, or get in touch. The developers who helped build our SDK from the ground up would be happy to walk you through your options

Sanity Image

Shirley Gong

Share this post

email
linkedIn
twitter