Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Thu May 02, 2013 1:29 pm

I've just installed latest version of Spire.doc standard Edition and the method

document.SaveToFile(fileNameTemp, FileFormat.Docx);

doesn't work properly.

It works only if fileNameTemp already exists (the file is overwritten) but if fileNameTemp does not exist no file is created.

With the previous installed version it worked fine

Could you help?


Posts: 5
Joined: Tue Jan 08, 2013 2:28 pm

Fri May 03, 2013 2:47 am


Thanks for your inquiry.

Sorry for inconvenience, if fileNameTemp does not exist no file is created, the version of Spire.doc standard Edition doesn't support the method document.SaveToFile(fileNameTemp, FileFormat.Docx), and you could use the method document.SaveToStream(stream, FileFormat.Docx); In regards to the issue, we will fix it in the next version. If you would use the method document.SaveToFile(fileNameTemp, FileFormat.Docx), please download the Spire.doc pro version from the link that http://www.e-iceblue.com/Download/download-word-for-net-now/spiredoc-pack-hot-fix4722.html?Itemid=0

E-iceblue support team
User avatar

Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue May 07, 2013 9:29 am

Dear gmb,

Please test SaveToStream(ms, FileFormat.Docx) method of Spire.doc standard Edition 4.7.19. I attached some code below.
Code: Select all
using (MemoryStream ms = new MemoryStream())
                Document document = new Document();
                Section section = document.AddSection();
                section.AddParagraph().AppendText("Hello World!");
                document.SaveToStream(ms, FileFormat.Docx);
                File.WriteAllBytes("sample.docx", ms.ToArray());

We will inform you as soon as the new standard Edition which fixes SaveToFile(fileNameTemp, FileFormat.Docx) method is released.

E-iceblue support team
User avatar

Posts: 2626
Joined: Wed Jun 27, 2012 8:50 am

Wed May 08, 2013 10:23 am

I changed my code to use SaveToStream method and it works.


Posts: 5
Joined: Tue Jan 08, 2013 2:28 pm

Return to Spire.Doc