ComponentOne Word for UWP
Working with Word for UWP / Advanced Level Working / Export UI
In This Topic
    Export UI
    In This Topic

    Word for UWP enables you to export UI to a document.

    Note that a class named WordUtils is used in the code given below. It is available in the product sample located at the following location on your system:
    Documents\ComponentOne Samples\UWP\WordSample
    You can use these classes in your application from the mentioned location.

    Using Word for UWP, you can export UI as an image which then draws this image in word document. Use the following code to export the UI to a word document:

    Dim _doc As New C1WordDocument()
    _doc.Clear()
    progressRing.IsActive = True
    _doc.Landscape = True
    panel.Arrange(_doc.PageRectangle())
    
    ' Draw every UI elements inside the panel in word document.
    Await _doc.DrawElement(panel, _doc.PageRectangle())
    WordUtils.SetDocumentInfo(_doc, Strings.RenderUIDocumentTitle)
    WordUtils.Save(_doc)
    progressRing.IsActive = False
    
    C1WordDocument _doc = new C1WordDocument();
    _doc.Clear();
    progressRing.IsActive = true;
    _doc.Landscape = true;
    panel.Arrange(_doc.PageRectangle());
    
    // Draw every UI elements inside the panel in word document.
    await _doc.DrawElement(panel, _doc.PageRectangle());
    WordUtils.SetDocumentInfo(_doc, Strings.RenderUIDocumentTitle);
    WordUtils.Save(_doc);
    progressRing.IsActive = false;
    

    The output of the above code will look similar to the image given below: