Howdy,
I noticed that if I populate a cell via its “HtmlString” property and then save to “.html” format some style properties are lost (“text-decoration” is one of them).
But other styles (like “color” for example) are working fine.
Please check the code below and notice that when saving to “.xsl” then everythign works fine.
Please advice.
Here is the code snipped:
Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets[0];
var htmlString1 = “<font style=“font-weight:normal;text-
decoration:underline;color:red;”>Red1” +
“<font style=“font-weight:normal;text-
decoration:underline;color:green;”>Green1”;
var cell1 = ws.Cells[1, 1];
cell1.HtmlString = htmlString1;
var htmlString2 = “<font style=“font-weight:normal;text-
decoration:underline;color:red;”>Red2” +
“<font style=“font-weight:normal;text-
decoration:underline;color:green;”>Green2”;
var cell2 = ws.Cells[3, 1];
cell2.HtmlString = htmlString2;
var range2 = ws.Cells.CreateRange(3, 1, 5, 5);
range2.Merge();
var myDir = @“C:\MyDir”;
//XlsSaveOptions saveOptions = new XlsSaveOptions();
//Uncomment the line above and comment out
//the line below to see that everything works if saving is to “.xsl”.
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
wb.Save(myDir + “TestAsPoseExcel_9.xls”, saveOptions);
@bogdanw,
The shared code is not compiling, could you please share runnable code so that we can reproduce the problem and provide our feedback after analysis.
Well, you have to add some “using” directives (like using Aspose.Cells;)
and set myDir variable to something which would work on your local machine.
I would assume that you can solve this type of problems … .
@bogdanw,
Thank you for the suggestion. We were facing little issue in formatting the HTML string but it was resolved.
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as
CELLSNET-47308 – Few properties missing in output HTML after setting Cell.HtmlString
Thanks.
I just want to add a comment - the problem (as described above) is not only that “text-decoration” style attribute disappears when saving to “.html” format. There seems to be some problems when saving to “.xls” as well, for example, “
” tag seem to be not working (but when saving to “.html” format “
” tag comes through shining). It could be a different issue though. But still related to the original I guess, so putting this comment here.
Me again …
Got this “line break” issue I mentioned above resolved.
All is needed is to set:
style.IsTextWrapped = true and styleFlag.Wrap = true
on proper “Style” and “StyleFlag” objects.
Sorry for the mess … .
Anyhow, maybe there is a similar workaround for “text-decoration” property?
If so, let me know please.
@bogdanw,
Thank you for the feedback. We are working on the logged issue and will share our feedback soon.
@bogdanw,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47308”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
@bogdanw,
Please try our latest version/fix: Aspose.Cells for .NET v20.4.4 (attached)
Your issue should be fixed in it.
Let us know your feedback.
Aspose.Cells20.4.4 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.4.4 For .Net4.0.Zip (5.4 MB)
Aspose.Cells20.4.4 For .NetStandard20.Zip (5.3 MB)
The issues you have found earlier (filed as CELLSNET-47308) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi