Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Sun Jul 26, 2020 9:33 pm

I'm experiencing a freeze in my code when loading a specific HTML file into an instance of the Document class.

The code is below and the file in question is attached. I thought that the issue may be to do with CSS files or URLs no longer being valid but in the testing I did I couldn't prove this, but include it in case it helps.

Please let me know if I can provide any additional information to help resolve this issue.

Darren

Code: Select all
        public void LoadHTML()
        {
            string strFileName = @".\CrashEmailOriginal.html";
            Spire.Doc.Document doc = new Document(strFileName, FileFormat.Html); // The method doesn't seem to return and CPU utilisation increases upon calling

            // This code will never be reached
            doc.Dispose();
        }

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Mon Jul 27, 2020 10:36 am

Hello,

Thanks for your post.
I tested your case with the latest version (Spire.DOC (hot fix) version 8.7.5 ). I didn't encounter the freeze. It could work. The attachment is my testing result. I suggest that you use this version to test your case if you were using an old version. If your issue still exists, please share us with your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) to help further look into it. However, you can find the css style didn't be applied. Kindly that our product is following the rules of MS Word. Even using Microsoft Word to open your HTML directly, it has the same result document. Hope you can understand.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Mon Jul 27, 2020 1:11 pm

Thanks for the quick response.

Yes, I confirm I'm using Hotfix 5.7.5 and that Word loads the file successfully. Other system details. I'm using Windows Pro 10 English. I agree and understand that if the document doesn't open in Word then I shouldn't expect it to open using the Spire libraries.

Let me know if there's anything else that I can provide to help with your investigations,

Darren.

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Tue Jul 28, 2020 2:24 am

Hello,

Thanks for your response.
Do you mean that the latest Spire.DOC 8.7.5 has solved your freezing problem? If so, glad to hear that! Meanwhile, you can refer to the following sample code to save it as a word document. Like yesterday mentioned that the css style didn't be applied, it did the same behavior in MS Word. Sorry at present our Spire.Doc also doesn't have a better way.
Code: Select all
      string strFileName = @"CrashEmailOriginal.html";   
      Spire.Doc.Document doc = new Document(strFileName, FileFormat.Html);           
      doc.SaveToFile("test.docx", FileFormat.Docx);           
      doc.Dispose();

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Tue Jul 28, 2020 6:15 am

Thanks for the response. I'm afraid the freeze still happens using Spire.Doc v 8.7.5.4046.

I'm not concerned about the CSS not being applied, that resource no longer exists, but both Word and Chrome will load the HTML and render it correctly without the CSS being found.

When I run the code sample provided though, the code never gets past the following line of code:

Code: Select all
 Spire.Doc.Document doc = new Document(strFileName, FileFormat.Html);


I have left this code running for 5 minutes without the call returning, Chrome renders the page in less than a second. I have other tests that are working without issue, with the only difference being the HTML file being passed to the code.

Let me know if I can provide any information to help your investigations.

wraydc
 
Posts: 130
Joined: Wed Apr 11, 2018 5:14 am

Tue Jul 28, 2020 11:35 am

Hello,

Thanks for your more information.
After testing in VS2017 with Spire.Doc v 8.7.5.4046, I did reproduce the freezing problem. This issue has been logged into our bug tracking system with the ticket SPIREDOC-4843, our Dev team will do more investigations and fixing. Once there is any update, I will let you know.
Meanwhile, our Spire.PDF supports converting Html to PDF with plugin. And I found the format of output is much better. Here I uploaded a testing Demo which I used Spire.PDF Pack(Hot Fix) Version:6.7.8, you can find my testing results in the bin/debug folder or run my Demo directly.

Sincerely,
Sofia
E-iceblue support team
User avatar

Sofia.Yang
 
Posts: 84
Joined: Tue Jul 14, 2020 1:41 am

Return to Spire.Doc