LoginSignup
1
0

More than 3 years have passed since last update.

OutSystemsでzipファイルを扱う

Posted at

環境に標準で付属するAPIを用いたzipファイル展開・圧縮方法を確認します。
公式ドキュメントが見つからなかったので、Action インターフェースと説明を元に、動作確認した結果を以下にまとめます。

サンプル

Forgeコンポーネント:https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=7086
Zip Screenを参照してください。

環境

Personal Environment(Version 11.0.606.0)
Service Studio(Version 11.6.17)
Zip Extension(For version 11.0.606.0)

以下の通り、Manage Dependenciesダイアログで、Zip Extension要素への参照を追加しておきます。
組み込みのExtensionなのでインストールは不要。
qZip1.PNG

zipファイルの作成(圧縮)

処理手順
1. CreateZipでメモリ上にzipファイルを用意する(このCreateZipのOutput Parameter ZipHandleを、後続処理のInput Parameterに指定します)
2. メモリ上にファイルを用意し、1ファイルずつAddFileにBinaryを渡していく
3. メモリ上でZipファイルの変更(ファイルの追加)を確定する(CommitChanges)
4. メモリ上のZipファイルから、Binary Dataを取り出す(GetZipBinary)

実装例(Excelファイルを2つ追加したZipファイルを作成する例)
qZip_2.PNG

AddFileのParameter設定の例
ZipHandle:CreateZipのOutput Parameter
FileName:追加するファイルのファイル名(例:"Products1.xlsx")
DateTime:追加するファイルの作成日(例:CurrDateTime())
FileContent:追加するファイルの実体(Binary Data型)

zipファイルの展開

処理手順
1. LoadZipでZipファイルのバイナリ(Binary Data型。Upload Widgetなどから取得する)を読み込む
2. GetFilesでFile StructureのListとしてデータを取り出す

実装例
qZip_3.PNG

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0