OpenDocument(オープンドキュメント)とは、XMLをベースとしたオフィススイート用のファイルフォーマットです。今日はSpire.Presentationという無料のライブラリを使って、OpenDocumentをパワーポイントに変換する方法を紹介します。
下準備
1.E-iceblueの公式サイトからFree Spire. Presentation無料版をダウンロードしてください。
2.Visual Studioを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいSpire. Presentation.dllを参照に追加してください。
(Net 4.0を例としたら、デフォルトパスは“Bin→NET4.0→Presentation.dll”というようになります。)
```c# using Spire.Presentation;namespace odptoPDF
{
class Program
{
static void Main(string[] args)
{
//ファイルをロードします。
Presentation presentation = new Presentation();
presentation.LoadFromFile("Sample.odp",FileFormat.ODP);
// OpenDocumentファイルで保存します。
presentation.SaveToFile("OdptoPDF.pdf",FileFormat.PDF);
}
}
}
<h4><strong>実行結果</strong></h4>
<p><img src="https://cdn-ak.f.st-hatena.com/images/fotolife/l/lendoris/20210623/20210623145009.png" alt="f:id:lendoris:20210623145009p:plain" width="554" height="473" loading="lazy" title="" class="hatena-fotolife" itemprop="image" /></p>
<p> </p>