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”というようになります。)
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);
}
}
}
実行結果