emやパーセントなどのスケーラブルユニットに列の幅を設定する
Contents
[
Hide
]
スプレッドシートからHTMLファイルを生成することは非常に一般的です。列のサイズは多くの場合「pt」で定義されています。ただし、生成されたテーブルの幅が大きい場合、600pxのコンテナパネルの幅に適合させる必要がある場合があります。この場合、生成されたテーブルの幅が大きい場合に水平スクロールバーが表示される可能性があります。HtmlSaveOptions.WidthScalableをtrueに設定すると、この固定サイズをemやパーセントなどのスケーラブルな単位に変更して、より良い表示を行うことができます。
サンプルのソースファイルと出力ファイルは以下のリンクからダウンロードできます:
outsampleForScalableColumns.zip
This file contains 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-.NET | |
// Load sample source file | |
Workbook wb = new Workbook(sourceDir + "sampleForScalableColumns.xlsx"); | |
// Specify Html Save Options | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
// Set the property for scalable width | |
options.WidthScalable = true; | |
// Specify image save format | |
options.ExportImagesAsBase64 = true; | |
// Save the workbook in Html format with specified Html Save Options | |
wb.Save(outputDir + "outsampleForScalableColumns.html", options); |