Set column width to scalable unit like em or percent
Generating an HTML file from a spreadsheet is very common. The size of the columns is defined in “pt” which works in many cases. However, there can be a case where this fixed size may not be required. For example, if a container panel width is 600px where this HTML page is being displayed. In this case, you may get a horizontal scrollbar if the generated table width is bigger. It was required that this fixed size shall be changed into a scalable unit like em or percent to get a better presentation. Following sample code can be used where HtmlSaveOptions.width_scalable is set to true for creating scalable width.
Sample source file and output files can be downloaded from the following links:
outsampleForScalableColumns.zip
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 sample source file | |
wb = Workbook(sourceDir + "sampleForScalableColumns.xlsx") | |
# Specify Html Save Options | |
options = HtmlSaveOptions() | |
# Set the property for scalable width | |
options.width_scalable = True | |
# Specify image save format | |
options.export_images_as_base64 = True | |
# Save the workbook in Html format with specified Html Save Options | |
wb.save(outputDir + "outsampleForScalableColumns.html", options) |