HTMLに印刷エリア範囲をエクスポートする

可能な使用シナリオ

PDFレンダリングにはすでに利用可能な機能ですが、HTMLにも適用可能な、ワークシートの選択範囲である印刷範囲のみをエクスポートする場合があります。ワークシートのページ設定オブジェクトに印刷範囲を設定し、後でHtmlSaveOptions.export_print_area_onlyフラグを使用して選択範囲のみをエクスポートしてください。

サンプルコード

次のサンプルコードはワークブックをロードし、プリントエリアをHTMLにエクスポートします。この機能のテスト用にサンプルファイルを以下のリンクからダウンロードできます。

sampleInlineCharts.xlsx

from aspose.cells import HtmlSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Load the Excel file.
wb = Workbook(sourceDir + "sampleInlineCharts.xlsx")
# Access the sheet
ws = wb.worksheets[0]
# Set the print area.
ws.page_setup.print_area = "D2:M20"
# Initialize HtmlSaveOptions
options = HtmlSaveOptions()
# Set flag to export print area only
options.export_print_area_only = True
# Save to HTML format
wb.save(outputDir + "outputInlineCharts.html", options)