Cutting text of shape and text overlay in cells as converting xls/xlsx to html

Hello

I tried to convert excel document to html using aspose cell Api, but I have some problem about converting xls/xlsx to html.
First original xls document has a shape including text at top region, “01_01.html” was results of converting first original xls document to html using aspose cell Api.
please point to top region of document, it has cutting shape including text same as other sheet.

Second origianl xls document has a overlay text in cells, “01_06.html” was results of converting second original xls file to html using aspose cell engine.

I want to fix these problem and error. please help me about it.
thank you.
Best regards.

Hi Suixing,

Thank you for contacting Aspose support. First of all, please note that both of your provided sample spreadsheet seems to be corrupted/infectious as Excel is suggesting not to edit them in order to prevent any problems.

Anyway, I have evaluated both mentioned issue on my side while using the latest version of Aspose.Cells for Java 16.11.6 and I am able to notice both problems. Please find the details as follow.

  • Trimmed rectangle shape while converting 01_01.xls to HTML. This incident needs to be investigated by the product team therefore I have raised it as CELLSJAVA-42083 in our bug tracking system. We need some time to properly analyze the case and revert back with updates in this regard. Please be kind enough to check the attached image “comparison-01_01.xls.png” and confirm if I have captured the issue correctly.
  • Overlapping of the contents. This issue is caused due to the fact that the columns in sample 01_06.xls are not autofitted. You need to increase the column widths before converting the spreadsheet to HTML as demonstrated below.


Java

Workbook book = new Workbook(dir + “01_06.xls”);
for(int i = 0; i < book.getWorksheets().getCount(); i++)
{
Worksheet sheet = book.getWorksheets().get(i);
sheet.autoFitColumns();
}
book.save(dir + “01_06.html”, SaveFormat.HTML);

Thank you for your reply.

I will wait for your good results.
I will check overlapping of contents again using your autofit function.
Thank you for your help.
Regards.

Hi,


Thanks for your posting and using Aspose.Cells.

Hopefully autofit function will resolve your overlapping content issue. Besides, we will keep you informed with any update available in your ticket. Let us know if you encounter any other issue, we will look into it and help you asap.

Thank you for your reply.

My main issue was Trimmed rectangle shape while converting xls to HTML.
I will check this error track system everyday.
I hope it will resolve asap.
Thank you.
Regards.

Hi again,


We will keep you posted with any updates we receive in reference to the ticket CELLSJAVA-42083. In case you wish to check the status of the ticket, you can do that from the left hand pane of your original post (snapshot attached). Currently it shows Unresolved. and as soon as it is fixed, the status will be automatically changed to Resolved.

hello

I tried autofit function today, but I can not get good results.
I uploaded my results and please check it carefully.

I will wait for your good feedback.
thank you.
Regards.

Hi,


Thanks for your posting and using Aspose.Cells.

We are looking into your issue. However, I have manually (using Microsoft Excel 2013) autofit the width of all columns (of your both sheets) and then took the html (check the attachment) using the following code. It looks good to me. Let us know if it is correct or wrong. Thanks for your cooperation in this regard and have a good day.

Java
Workbook wb = new Workbook(dirPath + “man-01_06.xls”);
wb.save(dirPath + “out.html”);

Thank you for your reply.


If I have manually autofit the width of all columns and to convert to html using your saving code, that results are very good, but in generally we have lots of documents that can not have autofit progress.
Are we not able to convert lots of excel documents using aspose cell?
if it is possible, we can use wrap text function in excel using Aspose cells.
but I can not find it in Aspose cells.
if you know it, can you offer sophisticated source code?
I will wait for your better results.
thank you.
Regards.

Hi there,


You can apply the text wrapping on all contents of a worksheet while using the following piece of code. However, I do not think there is a problem in the result which was generated by auto-fitting the column widths as well. Please note, I have been testing the scenario against the latest available version of Aspose.Cells for Java 16.11.10 (attached). Could you please give it a try on your side with just autoFitColumns method? In case the problem persists, please share the screenshots of the problematic areas.

Java

Workbook book = new Workbook(dir + “01_06.xls”);
Style style = book.createStyle();
style.setTextWrapped(true);
StyleFlag flag = new StyleFlag();
flag.setWrapText(true);
for(int i = 0; i < book.getWorksheets().getCount(); i++)
{
Worksheet sheet = book.getWorksheets().get(i);
Cells cells = sheet.getCells();
cells.createRange(0, 0, cells.getMaxDataRow(), cells.getMaxDataColumn()).applyStyle(style, flag);
// sheet.autoFitColumns();
}
book.save(dir + “output.html”, SaveFormat.HTML);

Hi again,


We have further investigated the scenario related to the auto fitting of the column widths, and we believe that you are not getting the desired results because you are probably missing the font used in the spreadsheet. Please note, column widths directly depend on the size of the contents as well as the font used to style the contents. If the required font is not present/installed in the environment then Aspose.Cells will try to substitute the missing font with any available one. As a consequence the columns widths will change. Attached to this post is the font used in the spreadsheet along with the result generated with following piece of code. Please install the TTC font from the archive and give this scenario another try on your end.

Java

Workbook book = new Workbook(dir + “01_06.xls”);
for(int i = 0; i < book.getWorksheets().getCount(); i++)
{
Worksheet sheet = book.getWorksheets().get(i);
sheet.autoFitColumns();
}
book.save(dir + “output.html”, SaveFormat.HTML);

The issues you have found earlier (filed as CELLSJAVA-42083) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.