We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Html to excel conversion using Aspose cells, wrapText property turned on

Hi,

I am trying to convert the attached html to Excel using the following code snippet. I see the ActionData column has ‘WrapText’ property turned on in excel output and so the texts are wrapped. May I know how is this property turned on for this particular column? Attached both html and the excel output. If you notice the below code, I specifically mentioned as AutoFitColsAndRows to true which means the text should fit into the column without being wrapped, isn’t that correct?

private byte[] convertHtmlToExcel(byte[] htmlFile) throws Exception{
//Create html load options
HtmlLoadOptions opts = new HtmlLoadOptions();
opts.setAutoFitColsAndRows(true);
opts.setConvertNumericData(false); //This is to avoid displaying the large number as scientific notattion
//Create workbook from your HTML string
Workbook wb = new Workbook(new ByteArrayInputStream(htmlFile), opts);
wb.getWorksheets().get(0).setGridlinesVisible(true);
//Save the workbook in output format
ByteArrayOutputStream excelOut = new ByteArrayOutputStream();
wb.save(excelOut, new SpreadsheetML2003SaveOptions(SaveFormat.XLSX));
return excelOut.toByteArray();
}

Archive 2.zip (1.1 MB)

@paypaluser,
We have logged the issue as “CELLSJAVA-43308” in our database for investigations. Once we will have some news for you, we will update you in this topic.

Do we have any workaround? This is an urgent production issue? I tried using AutoFitterOptions but no luck

HtmlLoadOptions opts = new HtmlLoadOptions();
opts.setAutoFitColsAndRows(true);
AutoFitterOptions autoFitter = new AutoFitterOptions();
autoFitter.setAutoFitWrappedTextType(AutoFitWrappedTextType.PARAGRAPH);
opts.setAutoFitterOptions(autoFitter);
opts.setConvertNumericData(false); //This is to avoid displaying the large number as scientific notattion
//Create workbook from your HTML string
Workbook wb = new Workbook(new ByteArrayInputStream(htmlFile), opts);

@paypaluser,
We are sorry that no workaround can be suggested yet as this issue is logged too recently. We will analyze the issue soon and provide assistance accordingly.

@paypaluser,

This is to inform you that we have fixed your issue now. We will provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@paypaluser,

Please try our latest version/hotfix: Aspose.Cells for Java v20.9.8 (attached)
aspose-cells-20.9.8-java.zip (7.2 MB)

Your problem should be fixed with it.

Please give us your feedback.

thanks a lot. it worked

@paypaluser,

It is nice to know that your issue is resolved by the new fix. In the event of further queries or issue, feel free to write us back.

The issues you have found earlier (filed as CELLSJAVA-43308) have been fixed in Aspose.Cells for Java 20.10. This message was posted using Bugs notification tool by ahsaniqbalsidiqui