setHtmlString(value) not working always (Java)

range.getCellOrNull(0, 0).setHtmlString(html_string) not working properly.

if html string is strike + color doesnot work, in excel output i can see only color on string, strike is not appearing

eg: S2

if html string is color + strike works, in excel output i can see both color and strike on string,

eg: F1

So Issue is Html can be prepared both ways from front end which we dont have control. when i encounter 1st type. Excel output shows wrong output

Thanks in advance

Hi,


<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>Please try our latest version/fix: Aspose.Cells
for Java v8.3.1.6
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>I have tested with it using the following sample code and it works as expected, the output Excel file is fine with A1 cell having proper formatting (font color + strikethrough):
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>e.g
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>Sample code:
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-SG;mso-fareast-language:
EN-SG;mso-bidi-language:AR-SA”>
Workbook workbook = new Workbook();


Worksheet worksheet = workbook.getWorksheets().get(0);

Cell a1 = worksheet.getCells().get(“A1”);

a1.setHtmlString(“<span style="color:#ff00ff;">F1”);

workbook.save(“out1.xlsx”);


If you still find any issue, kindly do paste sample code (runnable) with template file to reproduce the issue on our end, we will check it soon.

Thank you.

Yes exactly font color + strike works perfect.

please check strike + font color.

Check this string : - S2 not working

Hi,

Thanks for providing further details.

I observed the issue as you mentioned now. It works when we use: “F1” as HTML string. But

Cell.setHtmlString does not work when using “S2” as input html
string. Generally, we follow Ms Excel standards and specifications, we have to check it out if we can support it or not.

e.g

Sample code:

Workbook workbook = new Workbook();

Worksheet worksheet = workbook.getWorksheets().get(0);

Cell a1 = worksheet.getCells().get(“A1”);

//a1.setHtmlString("<span style=“color:#ff00ff;”>~~F1~~");//it works

a1.setHtmlString("~~<span style=“color:#ff00ff;”>S2~~");//it does not work

workbook.save(“out1.xlsx”);

I have logged a ticket for improvements in HTML renderings with an id “CELLSJAVA-41177” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Save Editcancel

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


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