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.

Thu Aug 13, 2015 9:15 am

Hello,

Have you tried the code?
Has your issue been resolved?
Thanks for your feedback.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Oct 17, 2017 1:47 am

Hello. When i'm trying to convert .doc file (HttpPostedFileWrapper) I have an exeption "Can't open storage on LockBytes" for loading from stream.
Code:
Code: Select all
//we got HttpPostedFileWrapper file
Document spireDoc = new Document();
Stream stream = file.InputStream;
spireDoc.LoadFromStream(stream, FileFormat.Auto);  //exeption here
Directory.CreateDirectory("C:/eldocs");
spireDoc.SaveToFile("C:/eldocs/test_20171017110556367288.pdf",FileFormat.PDF);

What am i doing wrong? Option with the MemoryStream did not help.
Thanks for any help.

380372@mail.ru
 
Posts: 3
Joined: Tue Oct 17, 2017 1:22 am

Tue Oct 17, 2017 9:00 am

Hello,

Thanks for your inquiry.
Could you please provide us with the input file and the information of the testing environment for further investigation ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Oct 18, 2017 12:14 am

Link with .doc file (cyrillic).
https://yadi.sk/d/q0DkPREv3Nqtqf

Visual Studio Community 2015
ASP.NET MVC 5
.NET Framework 4.5.2
Windows 7 Professional
Intel Core i5-4460, 3200 MHz
64-bit

380372@mail.ru
 
Posts: 3
Joined: Tue Oct 17, 2017 1:22 am

Wed Oct 18, 2017 3:26 am

Hello,

Thanks for your inquiry.
After testing with the latest Spire.Doc Pack(hot fix) Version:6.0.21, I found the file could be loaded directly by file name(document.LoadFromFile("test.doc")), yet it cannot be loaded by stream. It threw an exception "This is not a structured storage file", and it is not same as yours. And I have posted the issue I found to our Dev team. Could you please check if the stream you got was correct ? Could you please provide the stream data and the code how you get the stream(The better to provide a sample project) for testing ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 19, 2017 7:32 am

Link with test project with same code.
https://yadi.sk/d/vHrEDzK_3Nt6YT

I'm use FreeSpire.Doc 5.7.0 version. The file is the same.
Thanks.

380372@mail.ru
 
Posts: 3
Joined: Tue Oct 17, 2017 1:22 am

Thu Oct 19, 2017 8:03 am

Hi 380372@mail.ru,

Many thanks for your project.
The free Spire.Doc indeed threw the exception "Can't open storage on LockBytes", and the version V6.0.21 threw the exception "This is not a structured storage file" I mentioned. I had posted it to our Dev team, once there is any progress, we will let you know.
In addition, after investigation, actually, the file is a html file, the method you used cannot recognize the HTML format at present, please use the method below.
Code: Select all
            document.LoadFromStream(stream, FileFormat.Html,XHTMLValidationType.None);

Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Oct 23, 2017 8:53 am

Hi 380372@mail.ru,

Thanks for waiting.
Now the issue with the method "document.LoadFromStream(stream, FileFormat.Atuo);" has been fixed in Spire.Doc Pack(hot fix) Version:6.0.31.
Looking forward to your feedback.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 24, 2017 9:21 am

Hi 380372@mail.ru,

Greetings from E-iceblue.
Has the issue been resolved ?
Your feedback would be much appreciated.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc