Hi ,
When I am converting the Html content into Markdown, it occurs the error:
Object reference not set to an instance of an object.
here is the html content:
<table id=\"attributesTable\">\n <tbody>\n <tr>\n <td>這是一段測試文字。 <br> <br> <strong>※ 這是一段測試文字。<br> 進行一次換行</strong>\n </td>\n </tr>\n </tbody>\n</table>
I’m using the latest version of Aspose.Html
and I am using the method Converter.ConvertHTML
The method that I used:
I found that if the pattern <strong> ... <br> ...</strong>
is in the <table></table>
, it will occur the error.
However, <strong> ... <br> ...</strong>
is OK when it is not in the <table></table>
Looking forward to your reply, thanks a lot!
@Rachel_Lee
It appears you are encountering a NullReferenceException
when converting HTML content to Markdown using the Converter.ConvertHTML
method from Aspose.Html. This error typically occurs when the code attempts to access an object that has not been initialized.
From your description, it seems the issue arises specifically when the <strong>
tag is used within a <table>
. This may indicate a limitation or a bug in the conversion process when handling certain HTML structures.
Here are several steps you can take to troubleshoot and potentially resolve the issue:
-
Simplify the HTML: Remove the <strong>
tag or simplify the HTML structure to see if the conversion works without it. This can help confirm if the issue is indeed related to the <strong>
tag within the <table>
.
-
Update Aspose.Html: Ensure you are using the latest version of Aspose.Html, as updates may include bug fixes that could resolve this issue.
-
Check for Known Issues: Review the Aspose forums or documentation for any known issues related to HTML to Markdown conversion, particularly involving tables and formatting tags.
-
Alternative Conversion: If the problem persists, consider converting the HTML to a different format first (such as plain text or another intermediary format) and then to Markdown. This might help bypass the issue with the <strong>
tag in the table.
-
Contact Support: If none of the above solutions work, consider reaching out to Aspose support with your specific HTML content and the error details. They may provide a more targeted solution or workaround.
If you have any further questions or need additional assistance, please feel free to ask!
It still cannot fix the problem, since my document contains the pattern that will occur the error
@Rachel_Lee
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): HTMLNET-6646
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thanks,
And can I know that issue has been solved ?
@Rachel_Lee
We investigated and tried to reproduce this issue. This is our code to test. Exception isn’t reproduced, we checked it on v.25.8 and current develop version for Markdown as well as other output formats:
private static string s_html = "<table id=\"attributesTable\">\n <tbody>\n <tr>\n <td>這是一段測試文字。 <br> <br> <strong>※ 這是一段測試文字。<br> 進行一次換行</strong>\n </td>\n </tr>\n </tbody>\n</table>";
public void Run()
{
var outputPath = Path.Combine(OutputFolder, "output.md");
var options = new MarkdownSaveOptions();
Converter.ConvertHTML(s_html, ".", Configuration, options, outputPath);
}
It looks quite strange. Could you please provide any additional information about environment the issue appeared in?
If possible, provide a full stack after the reported exception. Probably this is a font problem and an exception is thrown on the concrete font. Please share a source document as an HTML file - maybe some characters were lost on copying.