I have a sql database table with a field that has rich text html code in it. I need to export this field to a cell in export. Is this even possible? if so please let me know the syntax to use.
thanks
Pimentinho
I have a sql database table with a field that has rich text html code in it. I need to export this field to a cell in export. Is this even possible? if so please let me know the syntax to use.
thanks
Pimentinho
Hi Pimentinho,
Thank you for considering Aspose products.
If I am correct in my understanding, you wish to insert HTML code in a spreadsheet cell. This is possible using the Cell.HtmlString property. Please check the below provided sample code and attached resultant Excel file for your reference.
C#
This Paragraph
I tried your example and only received “This Paragraph”. here is my code.
This Paragraph
VB.net
so if you could give examples in it rather than C# I would appreciate it.Hi Pimentinho,
Thank you for your response.
I am not sure why can’t you see the results on your end. I have performed the same procedure again on my machine, and the resultant Excel file seems just fine in MS Excel 2010 and 2007. Attached to this post is my resultant Excel spreadsheet as well as the snapshot of it for elaboration purposes. Please give a try again with the latest version of Aspose.Cells for .NET (Latest Version) , if you are previously using any older version of the component.
Below provided is the sample code in VB.NET
This Paragraph
I am retrieving the html code for a field in a sql table ... in your example, you are hard coding the html tags in it ... I am just using the value that was stored ... I am able to get it to insert into the cells BUT .. it is adding an additional crlf on every line ... and it is not displaying correctly all the tags ... can you give me a list of all the current html tags that are allowed ... and tell me how to get rid of the extra lines? thanks
Hi David,
Most commonly used text formatting HTML tags such as bold, italic, paragraph, break etc; are supported at the moment, therefore such tags should render properly when injected in a worksheet cell. A complete list of all supported tags isn’t readily available but we can compile a list for you. In meanwhile, please share the HTML string that isn’t rendering properly. We can look into it to provide further guidance in this regard.
here is an example: An extra crlf is added between lines … and there are no dot points for the indented items.
Hi David,
Thank you for providing the HTML string in question. By looking at the shared HTML code, it seems that the said problems could be due to the illegal usage of
tags within
tag is not inserted at the end of an item beginning with a
I am still having problems with the extra lines showing up. My management really wants me to get rid of them. I have attached screen shots of the results … as well as what it looks like when I stop the code and look at the variable X (in yellow below) and look at the text and the html views.
Hi David,
Thank you for writing back.
The said behaviour could be a bug in your current version of Aspose.Cells for .NET component because your HTML string seems to be OK with an exception of one
I installed the version of Aspose and am still having the same problems.
Here are the four html strings that I am using in my testing.
Example 1
"
Example 2
"
"
Example 3
"
* asterix 1
" & vbCrLf & "* asterix 2
" & vbCrLf & "
" & vbCrLf & "*asterix 3
" & vbCrLf & "*asterix 4
" & vbCrLf & "x
" & vbCrLf & "(1) number 1
" & vbCrLf & "(2) NUMBER 2
" & vbCrLf & "
" & vbCrLf & ". period 1
" & vbCrLf & ". period 2
" & vbCrLf & "
" & vbCrLf & "
" & vbCrLf & "
Hi David,
Thank you for providing your sample HTML string for our review.
I believe, “&vbCrLf &” is an unwanted string and it could be causing the carriage return. Anyhow, I have removed it manually and saved the results to a spreadsheet, that does not show the unwanted line breaks anymore. Please have a look at the below provided code snippet and resultant attached output.
C#
<span style=“text-decoration: line-through;”>
”;* asterix 1
* asterix 2
*asterix 3
*asterix 4
x
(1) number 1
”
+ “(2) NUMBER 2
. period 1
. period 2
I have ran the above example against the most recent version of Aspose.Cells. And bullet points are still not rendered for unordered lists among other tags not being honored. Is this on the queue for fixes? Also could a list of supported tags being provided?
Hi Zach,