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.

Fri Mar 11, 2022 10:40 am

Hello, I am using the free version of Spire.Office for .NET and for some reason saving old word files doesn't work.
I am using MemoryStreams to pass the binary data and the problem is probably coming from the save methods, because for .docx I don't have any issues.
I tried using files on my disk and used both SaveToFile and SaveToStreams methods, but nothing seems to work.
I do get a word file, but it is corrupted with a bunch of gibberish.

If there are some configurations on the document class I need please tell, also I haven't used any licence because I am just testing conversions for a course project.

I uploaded the file I am trying to convert and what I get in return.
I also tested with other types and nothing seems to work for .doc and also tried only the separate package of Spire.Doc.

This is my code:

Document document = new Document();
document.LoadText(".\\test123.txt", Encoding.UTF8);
MemoryStream outputStream = new MemoryStream();
document.SaveToFile(".\\test123.doc", Spire.Doc.FileFormat.Doc); or document.SaveToStream(outputStream, fileFormat);

Kris1999
 
Posts: 2
Joined: Fri Mar 11, 2022 10:22 am

Mon Mar 14, 2022 3:24 am

Hello,

Thanks for your inquiry.
I tested your case and viewed the result file using MS Word 2010 and found no problems. I also checked the word file you provided with the same tool, and the content is displayed exactly as it should (as shown in the screenshot). Please tell us which viewing tool you use.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Mon Mar 14, 2022 12:39 pm

Hello, I am using WordPad. It seems the problem was coming from the viewing tool as I tested with MS Word 2010.
Thanks for the fast reaction and sorry for the inconvenience!

Kris1999
 
Posts: 2
Joined: Fri Mar 11, 2022 10:22 am

Tue Mar 15, 2022 1:10 am

Hello,

You are welcome.

If you encounter other issues related to our products in the future, please feel free to contact us.

Have a nice day!

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc