Spire.Presentation for Javaが、強いライブラリだって皆さんもうご存知でしょう?Spire.Presentation for Javaは、いろいろな機能を搭載しています。とりわけ、その変換機能は素晴らしいし、PowerPointを様々なファイル形式に変換できますので、とても便利なライブラリですね。だから今日PowerPointをHTML形式に変換する方法を紹介させていただきます。
1.E-iceblueの公式サイトからSpire. Presentation for Javaをダウンロードしてください。
2. IDEを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいSpire. Presentation.jarを参照に追加してください。
public class ToHtml {
public static void main(String[] args) throws Exception {
// Presentation オブジェクトを作成します。
Presentation presentation = new Presentation();
//サンプルファイルをロードします。
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pptx");
//HTMLで保存します。
presentation.saveToFile("C:\\Users\\Administrator\\Desktop\\ToHtml.html", FileFormat.HTML);
}
}
<h4><strong>実行結果</strong></h4>
<p><img src="https://cdn-ak.f.st-hatena.com/images/fotolife/l/lendoris/20210923/20210923152051.png" alt="f:id:lendoris:20210923152051p:plain" width="554" height="323" loading="lazy" title="" class="hatena-fotolife" itemprop="image" /></p>
<p style="margin: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; line-height: 1.6; color: #000001; overflow-wrap: break-word; padding: 0px;"><strong style="font-weight: bold; margin: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; line-height: 1.6; color: #000001; overflow-wrap: break-word;"> </strong></p>
<p style="margin: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; line-height: 1.6; color: #000001; overflow-wrap: break-word; padding: 0px;"> </p>
<p style="margin: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; line-height: 1.6; color: #000001; overflow-wrap: break-word; padding: 0px;"> </p>