列幅を em やパーセントなどのスケーラブルな単位に設定する
Contents
[
Hide
]
スプレッドシートから HTML ファイルを生成することは非常に一般的です。列のサイズは、多くの場合に機能する「pt」で定義されます。ただし、この固定サイズが必要ない場合もあります。たとえば、コンテナ パネルの幅が 600px で、この HTML ページが表示されている場合。この場合、生成されたテーブル幅が大きいと、水平スクロールバーが表示されることがあります。この固定サイズは、表示を改善するために em やパーセントなどのスケーラブルな単位に変更する必要がありました。次のサンプル コードは、次の場所で使用できます。HtmlSaveOptions.WidthScalableに設定されています真実スケーラブルな幅を作成するため。
サンプル ソース ファイルと出力ファイルは、次のリンクからダウンロードできます。
outsampleForScalableColumns.zip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Load sample source file | |
Workbook wb = new Workbook(srcDir + "sampleForScalableColumns.xlsx"); | |
// Specify Html Save Options | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
// Set the property for scalable width | |
options.setWidthScalable(true); | |
// Specify image save format | |
options.setExportImagesAsBase64(true); | |
// Save the workbook in Html format with specified Html Save Options | |
wb.save(outDir + "outsampleForScalableColumns.html", options); |