Exception when loading html file

Technical support for Spire.Doc

Moderator: iceblue support

Exception when loading html file

Postby cupa » Mon Aug 27, 2012 1:23 pm

I'm trying to open an html file that was created from a html string and I'm getting an IndexOutOfRangeException. Here's some sample code:

Code: Select all
 
public void writeHtmlAsDoc(String html) {
     var tempFile = @"temp html file path";
     var docFile = @"doc file path";
     System.IO.File.WriteAllText(tempFile, html);
     Spire.Doc.Document document = new Spire.Doc.Document();
     document.LoadFromFile(tempFile, Spire.Doc.FileFormat.Html, XHTMLValidationType.None); //exception thrown here
     document.SaveToFile(docFile, Spire.Doc.FileFormat.Doc);
}


The exception is thrown when calling LoadFromFile(). I'm using the trial version 4.4.16.
cupa
 
Posts: 3
Joined: Fri Aug 24, 2012 7:38 pm

Re: Exception when loading html file

Postby amy.zhao » Tue Aug 28, 2012 5:28 am

Hi cupa,

I have done a test, but don't reproduced your problem. Your problem may be produced by your html files. Could you provide your html files for us? So that we can reproduce your problem, and solve it quickly.

Best wishes.
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Exception when loading html file

Postby cupa » Tue Aug 28, 2012 3:35 pm

I was able to figure out the problem. I was using a browser based wysiwyg html editor. I was writing valid html but after posting it to the server the editor was changing the html a bit. Which must have been formatted weird. I tried it with another editor and it seems to be working fine now. Thank you
cupa
 
Posts: 3
Joined: Fri Aug 24, 2012 7:38 pm

Re: Exception when loading html file

Postby cupa » Tue Aug 28, 2012 7:25 pm

I also am having some other issues. I've notice that when I convert a Doc to Html it looks almost exactly like the document. However when I convert that Html file (without changing anything) back to a Doc file I'm getting a file that doesn't look quite right. Many blank pages are added to the document because there is a lot of spacing in between random bits of text. It turned a 18 page document into a 100+ page document. Also regular text turns into links to the directory of the html file. This has been a common problem across multiple documents. If you give me an email I can send a copy of a document where the link problem occurs. I will try to get an example of where the page spacing occurs.
cupa
 
Posts: 3
Joined: Fri Aug 24, 2012 7:38 pm

Re: Exception when loading html file

Postby amy.zhao » Wed Aug 29, 2012 5:46 am

Hi cupa,

Please send your docuemnt to me by mailbox. My e-mail address is amy.zhao@e-iceblue.com or support@e-iceblue.com. Thanks.

Best wishes,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Exception when loading html file

Postby amy.zhao » Thu Aug 30, 2012 6:00 am

Hi cupa,

Could you provide us your original doc? So that we can reproduce your problem and solve it quickly. Thanks.

Best wishes,
Amy
e-iceblue support
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 0 guests

cron