Hi,
Do your product support importing HTML with stylesheets to Excel? Styles would include font style, border style, column width, number format etc.? Is that supported? I know html can be imported, but had some issues with importing using ImportHTMLTable() while style sheets are not recognized by your component. Let me know what best options to import an HTML document with embedded style
Thanks Ramya! I tried the second link you provided and it failed with below error: Used the same code and data file from github.
System.ArgumentException: 'rgb(255 is not a valid value for Int32. (Parameter 'htmlColor')'
Also, the data html file has lot of css class references. For example,
<th class="X64" style="text-align:left;">
Where is the definition for X64? Can that be under the <style> </style> tag similar to a regular html/css file?
Thanks a lot!
Sunil
Also, is there a way I can indicate the custom cell formats (Number formats) for Currency, 100 separator etc. while importing html?
THanks!
Sunil
|
Query |
Response |
|
Where is the definition for X64? Can that be under the <style> </style> tag similar to a regular html/css file? |
Yes, we can add the definition for the X64 and X65 under the style tag. We will update the changes and republish the GitHub sample.
As for now, please try the sample in the above link. |
|
Also, is there a way I can indicate the custom cell formats (Number formats) for Currency, 100 separator etc. while importing html? |
You can apply the Custom cell formats for the cells in the Excel file after importing the HTML. Please refer to the UG documentation from the below link.
|
Thanks Ramya for the detail! Able to use your recommendation for those. I have run into another issue, which I had pointed out earlier. Do you know why this happens?
Description: An unhandled exception
occurred during the execution of the current web request. Please review the
stack trace for more information about the error and where it originated in the
code.
Exception Details: System.Xml.XmlException: '<', hexadecimal
value 0x3C, is an invalid attribute character. Line 1, position 121.
Source Error:
Line 399: Dim byteArray As Byte() = Encoding.UTF8.GetBytes(reportHTML)Line 400: Dim MStream As MemoryStream = New MemoryStream(byteArray)Line 401: worksheet.ImportHtmlTable(MStream, 6, 1)Line 402:Line 403: ' Set Report Label to left aligned |
Source File: C:\Users\sunil\source\repos\FMCWebAppNew\report\rBalanceRecapWithFuturesMonth.aspx.vb
Line: 401
Stack Trace:
[XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 1, position 121.] System.Xml.XmlTextReaderImpl.Throw(Exception e) +73 System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) +81 System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr) +5382008 System.Xml.XmlTextReaderImpl.ParseAttributes() +853 System.Xml.XmlTextReaderImpl.ParseElement() +381 System.Xml.XmlTextReaderImpl.ParseElementContent() +120 System.Xml.XmlTextReaderImpl.Read() +45 System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +57 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +21 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +133 System.Xml.XmlDocument.Load(XmlReader reader) +109 System.Xml.XmlDocument.LoadXml(String xml) +168 Syncfusion.XlsIO.Implementation.HtmlStringParser.ParseHtml(String html, IRichTextString range) +140 Syncfusion.XlsIO.Implementation.RangeImpl.set_HtmlString(String value) +91 Syncfusion.XlsIO.Implementation.HtmlToExcelConverter.ParseTableColumn(XmlNode colNode, WorksheetImpl worksheetImpl, Int32 row, Int32 col) +263 Syncfusion.XlsIO.Implementation.HtmlToExcelConverter.ParseTableRow(XmlNode rowNode, WorksheetImpl worksheetImpl, Int32& maxMergedRow, Int32 row, Int32 col, Dictionary`2 styles, Int32 tableRow, TextFormat format, Boolean& isColumnDisplay) +885 Syncfusion.XlsIO.Implementation.HtmlToExcelConverter.ParseHTMLTable(String htmlText, WorksheetImpl worksheetImpl, Int32 row, Int32 col) +1549 Syncfusion.XlsIO.Implementation.WorksheetImpl.ImportHtmlTable(Stream fileStream, Int32 row, Int32 column) +215 FMC.rBalanceRecap.WriteReport |