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.
Tue Sep 19, 2017 7:11 am
How to load byte array with image to LoadFromStream? Any other approach besides write the byte array back to physical file first?
- Code: Select all
//the original docx [b]contains image[/b]
byte[] buffer = File.ReadAllBytes(docPath+docName);
//save buffer to database, then retrieve it back
using (MemoryStream stream = new MemoryStream(buffer)) {
Document doc = new Document();
doc.LoadFromStream(stream, FileFormat.Docx2013);
//the new docx [b]without image[/b]
doc.SaveToFile(docPath+docName2,FileFormat.Docx2013);
}
-
chtui
-
- Posts: 5
- Joined: Thu Sep 07, 2017 8:34 am
Tue Sep 19, 2017 7:32 am
Hello,
Thanks for your inquiry.
Our Spire.Doc has no limitation on the LoadFromStream method and your code works well on my side. To help us with a better investigation, could you please send your sample file to us(
support@e-iceblue.com)?
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am
Tue Sep 19, 2017 7:49 am
Thank you for your instant response, here is my word sample file
Login to view the files attached to this post.
-
chtui
-
- Posts: 5
- Joined: Thu Sep 07, 2017 8:34 am
Tue Sep 19, 2017 8:13 am
Hi,
Thanks for your reply.
I have confirmed that your attached file worked well with
Spire.Doc Pack(hot fix) Version:6.0.8. Please apply it and try again.
In addition, we can offer you a 1-month free license to help remove the warning message. Please contact our sales team (
sales@e-iceblue.com) to get it if you need.
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am
Tue Sep 19, 2017 10:47 am
The latest version of Spire.doc supports my sample file, thank you very much!
-
chtui
-
- Posts: 5
- Joined: Thu Sep 07, 2017 8:34 am
Wed Sep 20, 2017 1:25 am
Hi,
Thanks for your feedback.
Please feel free to contact us if you need any help.
Sincerely,
Jane
E-iceblue support team
-
Jane.Bai
-
- Posts: 1156
- Joined: Tue Nov 29, 2016 1:47 am