Word for UWP
UI のエクスポート
Word for UWP の操作 > 上級レベルの操作 > UI のエクスポート

Word for UWP  を使用すると、ドキュメントに UI をエクスポートできます。

次のコードでは、WordUtils という名前のクラスを使用します。このクラスは、システムの次の場所にある製品サンプル内に置かれています。
Documents\ComponentOne Samples\UWP\WordSample
これらのクラスを上記の場所からアプリケーションで使用できます。

Word for UWP を使用して、UI を画像としてエクスポートし、次にその画像を Word ドキュメントで描画できます。UI を Word ドキュメントにエクスポートするには、次のコードを使用します。

Dim _doc As New C1WordDocument()
_doc.Clear()
progressRing.IsActive = True
_doc.Landscape = True
panel.Arrange(_doc.PageRectangle())

' パネル内のすべての UI 要素を Word ドキュメントで描画します。
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());

// パネル内のすべての UI 要素を Word ドキュメントで描画します。
await _doc.DrawElement(panel, _doc.PageRectangle());
WordUtils.SetDocumentInfo(_doc, Strings.RenderUIDocumentTitle);
WordUtils.Save(_doc);
progressRing.IsActive = false;

上記のコードの出力は、次の図のようになります。