---
title: "Power AutomateでWordテンプレートから報告書を作成する"
emoji: "📝"
type: "tech"
topics: ["Power Platform", "Power Automate", "N"]
published: true
published_at: "2020-07-24 12:26"
cover: "./20200724122606.png"
category: "info"
author: "中村 薫"
description: "MSの鈴木あつしさんの動画内でのシナリオにあった、HoloLens 2で写真を撮影してCDSへアップロード、そこからPower AutomateでWordのテンプレート内に画像を差し込むというのがあったので、Power Automate以降"
original_url: "https://blog.hololab.co.jp/entry/2020/07/24/122647"
---
![](./20200724122606.png)

MSの鈴木あつしさんの動画内でのシナリオにあった、HoloLens 2で写真を撮影してCDSへアップロード、そこからPower AutomateでWordのテンプレート内に画像を差し込むというのがあったので、Power Automate以降の部分をやってみました。

![f:id:kaorun55:20200724121357p:plain](./20200724121357.jpg)

元動画はこちら

-   [https://www.youtube.com/watch?time\_continue=220&v=ixg1nOwViPw&feature=emb\_logo](https://www.youtube.com/watch?time_continue=220&v=ixg1nOwViPw&feature=emb_logo)

実際にやってみた手順の動画はこちら

<iframe width="480" height="270" src="https://www.youtube.com/embed/nPkYA13elvM?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>

[www.youtube.com](https://www.youtube.com/watch?v=nPkYA13elvM&feature=youtu.be)

このように左のWordテンプレートを画像を使って、右の画像が差し込まれた状態で出力されます。

![f:id:kaorun55:20200724122730p:plain](./20200724122730.png)

# ポイント

WordのテンプレートはWord Onlineにある「Microsoft Word テンプレートを事前設定します」を使用します。このフローはPREMIUMになるので、Power Automateの有償プランが必要です。

![f:id:kaorun55:20200724121509p:plain](./20200724121509.jpg)

続いて、Wordでテンプレートを作る際にWordの「開発」タブを使用しますが、既定で無効になっているので、Wordのオプションから有効にします。

![f:id:kaorun55:20200724121514p:plain](./20200724121514.jpg)

「開発」タブのデザインモードからPower Automateで差し込む場所を作成します。

![f:id:kaorun55:20200724121518p:plain](./20200724121518.jpg)

このファイルをPower Automateで指定すると、先ほどデザインモードで指定した箇所に埋め込むことができるようになります。

![f:id:kaorun55:20200724121522p:plain](./20200724121522.jpg)

最後に作成したファイルを保存して完了です。

![f:id:kaorun55:20200724121527p:plain](./20200724121527.jpg)

ちなみに今回同じSharePointサイトの別フォルダに読み書きしてるからか、フローチェッカーで再帰のエラーが出ています。フォルダが違うのでおそらく大丈夫だと思いますが、問題または解決策があれば教えてもらえると嬉しいです。

![f:id:kaorun55:20200724121531p:plain](./20200724121531.jpg)

# 参考

Power Automate周り

-   [Word テンプレートからPDFを作成するFlowのサンプル | もくだいさんのOffice365至高のレシピ](https://mokudai.jp/knowledge-base/power-automate/create-a-pdf-from-word-template/)
-   [Power Automate で扱う時刻を日本時間に変換したい | もくだいさんのOffice365至高のレシピ](https://mokudai.jp/knowledge-base/power-automate/automate-convert-time-utc2japantime/)

PowerApps/Power Automateのライセンス体系(費用)がわかりづらいのですが、吉田さんのブログにまとめられていました

-   [日本一わかりやすい、非公式なPower Appsライセンス表 - 吉田の備忘録](https://memo.tyoshida.me/power-platform/powerapps/unofficial-powerapps-flow-license-chart/)
