SaveToFile does not work

Technical support for Spire.Doc

Moderator: iceblue support

SaveToFile does not work

Postby gmb » Thu May 02, 2013 1:29 pm

Hi,
I've just installed latest version of Spire.doc standard Edition 4.7.19.53040 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 4.6.0.3040 it worked fine


Could you help?

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

Re: SaveToFile does not work

Postby Gary.zhang » Fri May 03, 2013 2:47 am

Hi,

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

Sincerely,
Gary
E-iceblue support team
User avatar
Gary.zhang
 
Posts: 1390
Joined: Thu Apr 04, 2013 1:30 am

Re: SaveToFile does not work

Postby amy.zhao » 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.

Regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2273
Joined: Wed Jun 27, 2012 8:50 am

Re: SaveToFile does not work

Postby gmb » Wed May 08, 2013 10:23 am

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


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


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 2 guests