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 Dec 06, 2011 12:26 pm

I have the following code:

var doc = new Document();
doc.LoadFromFile(sourceFile, FileFormat.Docx);
doc.Replace("<<username>>", des_name_report, true, true);
doc.SaveToStream(mstream, FileFormat.PDF);


SourceFile points to the attached file. The pdf file generated cannot be opened in any PDF reader.

It seems there is a bug in the PDF generation code. Is there a fix already available?

thanks.

joelcamargo
 
Posts: 4
Joined: Fri Nov 25, 2011 12:26 am

Wed Dec 07, 2011 3:52 am

Hello joelcamargo,

Sorry for late reply and thank you for your patience.

The file you sent to me without the string "<<username>>". I have simulated what you described. There are without any problems.

PS: I use the latest Spire.Doc HotFix 4.1.14. You can download it from the following address:http://www.e-iceblue.com/Download/download-word-for-net-now.html.

Here is the code:(I also attached you the pdf file)
Code: Select all
            Document document = new Document();
            document.LoadFromFile(@"..\..\AR1005.bad.docx",FileFormat.Docx2010);

            document.Replace(@"<<username>>", "des_name_report", true, true);
            document.SaveToFile(@"..\..\bad.docx",FileFormat.Docx2010);
            document.SaveToFile(@"..\..\bad.pdf",FileFormat.PDF);


If you still have any other questions, please feel free to contact us.
Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Wed Dec 07, 2011 7:27 pm

Thanks Tina. It really works after i installed the hot fix. I still have some other problemas but i will open a new post for them

thanks.

joelcamargo
 
Posts: 4
Joined: Fri Nov 25, 2011 12:26 am

Return to Spire.Doc