As the tag is not required in HTML-documents or the HTML-body of mails, some document conversions appear to be empty when they only contain a table as content.
How can I ensure, all content is visible exactly as it is when opened in a browser or mail program?
How exactly are you loading this content into a DocumentModel, can you please share your code that reproduces the issue so that I can help you out with it?
I use DocumentModel.Load() with the file path or in case of working with mails I use DocumentModel.Content.End.LoadText() with the text as string and LoadOptions.HtmlDefault. The document is then saved as Pdf with DocumentModel.Save() or converted to images by saving it pagewise with DocumentModel.GetPaginator().Pages and DocumentModelPage.Save().
I am using GemBox.Bundle in version 47.0.1024 in a .net472 Application.
This is a specific edge case that occurs because your <tbody> content doesn’t contain a table row, so it ends up being moved outside of it. However, in the case where you’re missing <html> (or <body>) there is no parent element where that invalid <tbody> content could be moved into.
using the table row tags helps, but I don’t edit the contents in my application’s general workflow. So adding tags is not my preferred solution. Is there any way to handle this within the document loading process, for example ensuring that a document contains valid HTML content when it is loaded with HtmlLoadOptions?
What exactly do you mean by that?
Do you mean that GemBox.Document should repair any HTML irregularity it encounters.
Note that GemBox.Document does try to do that, but I’m afraid some errors are more difficult to recover then others. Or better said, it can be challenging to have the same “repair” behavior as modern browsers have for some of those irregularities.
Nevertheless, we’ll investigate this context further.
I was thinking about something like a check for the standard HTML document start tags (as or ) and some sort of exception or note if they are missing completely. But I am not sure if this behaviour causes more problems than it solves, as these tags are not required for mails with HTML body (this is the context in which the problem originally occurred).
Newest version of GemBox.Bundle is working for the case of HTML documents, thank you!
But in case of loading the HTML body of mails (which had the problem of being shown empty before) to a document I received a NullReferenceException.
I am using GemBox.Bundle v. 47.0.1036 and the following statement:
var documentModel = new DocumentModel();
documentModel.Content.End.LoadText(_mailMessage.GetEmbeddedBodyHtml(), LoadOptions.HtmlDefault);
the file that I encountered the exception with is a confidential mail, I am afraid I cannot forward it.
However, when I have another file with the same behaviour that I can forward, I will notify you.
Most important: The main issue of this topic is fixed with the new GemBox version, thank you!