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.

Wed Sep 28, 2016 12:24 pm

Hi,
Can you help me?
When I try to edit Word docx file with mailmerge field in header and a picture in the document body, function MailMerge.Execute throws an error "The type initializer for 'spr[]' threw an exception". :cry: Evertying works ok when the picture is not present.
What am I doing wrong?

My code is:
Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(dir + fileName);
string[] filedNames = new string[] { "mailmerge_tajnost" };
string fieldvalue = " ";
if (pd.OZNAKA_TAJNOSTI != null && pd.OZNAKA_TAJNOSTI >= 0)
fieldvalue = Misc.dicStepenTajnostiMaternji[(int)pd.OZNAKA_TAJNOSTI];
string[] filedValues = new string[] { fieldvalue };
document.MailMerge.Execute(filedNames, filedValues);
document.SaveToFile(dir + fileName, FileFormat.Docx);

Thank you,
Gordana

gogili.vujovic@gmail.com
 
Posts: 2
Joined: Wed Sep 28, 2016 12:04 pm

Thu Sep 29, 2016 8:38 am

Hi,

Thanks for your inquiry. Could you please provide your document for looking into the problem?

Sincerely,
Alan
E-iceblue support team
User avatar

Alan.Li
 
Posts: 35
Joined: Mon Sep 05, 2016 2:51 am

Thu Sep 29, 2016 12:35 pm

Hi,

In attachment is the Word file.
Also I downloaded the latest Spire.Doc library, but I could not find the Spire.Doc.Document.MailMerge.Execute method, although your demo code hasn't changed.

Thank you in advance!

gogili.vujovic@gmail.com
 
Posts: 2
Joined: Wed Sep 28, 2016 12:04 pm

Fri Sep 30, 2016 8:25 am

Hi,

Thanks for your inquiry. I have tested your doucument using the Spire.Doc Pack(hot fix) Version:5.7.117, and everything works fine. Here is the generated document for your reference.
Sincerely,
Alan
E-iceblue support team
User avatar

Alan.Li
 
Posts: 35
Joined: Mon Sep 05, 2016 2:51 am

Return to Spire.Doc