Create a Word file in MAUI

GemBox.Document is a standalone .NET component with cross-platform support for processing documents. With the help of MAUI, you can use it on platforms like Android, iOS, Linux, and macOS for reading, writing, editing, and converting Word files.

The following example shows how you can create a DOCX file in a mobile application.

Word file generator on a native Android mobile app with MAUI
Screenshot of MAUI Android app that creates a Word file
<ContentPage xmlns=""


            <Label Text="GemBox.Document Example"
               Margin="0,0,0,30" />

            <Editor x:Name ="text"
                Text="Hi! This document was generated with GemBox.Document library." />

            <ActivityIndicator x:Name="activity" />

                Text="Create document"
                HorizontalOptions="Center" />


using GemBox.Document;
using System;
using System.IO;
using System.Threading.Tasks;

namespace DocumentMaui
    public partial class MainPage : ContentPage
        static MainPage()
        public MainPage()
        private async Task<string> CreateDocumentAsync()
            var document = new DocumentModel();

            document.Sections.Add(new Section(document,
                new Paragraph(document, text.Text),
                new Paragraph(document, new Picture(document, await FileSystem.OpenAppPackageFileAsync("fragonard_reader.jpg")))));

            var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Example.pdf");

            await Task.Run(() => document.Save(filePath));

            return filePath;

        private async void Button_Clicked(object sender, EventArgs e)
            button.IsEnabled = false;
            activity.IsRunning = true;

                var filePath = await CreateDocumentAsync();
                await Launcher.OpenAsync(new OpenFileRequest(Path.GetFileName(filePath), new ReadOnlyFile(filePath)));
            catch (Exception ex)
                await DisplayAlert("Error", ex.Message, "Close");

            activity.IsRunning = false;
            button.IsEnabled = true;

Limitations on Android or iOS

You can use the full functionality of GemBox.Document in MAUI applications, but with the following exceptions:

These features currently depend on WPF and require a .NET Windows Desktop Runtime. However, we plan to add cross-platform support for them in future releases.

See also

Next steps

GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API. How about testing it today?

Download Buy