Free Support Forum - aspose.com

MailMerge raises NullReferenceException

Hi.

I get a NullReferenceException when I call MailMerge. I have attached the document.
Version used is 10.3.0.0
Kind regards,
TK

bei x28925c9b27b37a46.x0a28863c804404d7.x775521112ede5e6f(x7e263f21a73a027a x5f36ad26e64b91c3, Node x98cacf1c34b53cca, xe83a6b069ec8efc2 xcbf24c118ac8aa0b)
bei xfbd1009a0cbb9842.x54b0ce4be209efe2.ApplyResultCore()
bei xfbd1009a0cbb9842.xf83652aff352c801.x7d44c41f397d72e0()
bei xfbd1009a0cbb9842.xca592a476766b11a.xb333e1e6c01c2be2()
bei Aspose.Words.Fields.Field.x295cb4a1df7a5add(x5e36356bc92c609b x0f7b23d1c393aed9)
bei xfbd1009a0cbb9842.xfedf115fd9c03862.x4e3cfc222c92cda7(Field xe01ae93d9fe5a880, x5e36356bc92c609b x0f7b23d1c393aed9)
bei xfbd1009a0cbb9842.xd9ffa68c877a30cb.xe332a1e8ad1c863d()
bei xfbd1009a0cbb9842.xe11422ab90fb5f3b.x90f31a16bab0c7f9()
bei xfbd1009a0cbb9842.xe11422ab90fb5f3b.x1ef2c3be187f37a2()
bei xfbd1009a0cbb9842.xe11422ab90fb5f3b.x2408a6db33935c93()
bei xfbd1009a0cbb9842.x2d380f6141585930.x2408a6db33935c93()
bei xfbd1009a0cbb9842.x985dd08fd338eeea.x1f490eac106aee12(x2d380f6141585930 xbce90b56ab411c23)
bei xfbd1009a0cbb9842.x985dd08fd338eeea…ctor(Field field, x5e36356bc92c609b updateContext, x6ed66b5cf8da2955 switchResolver)
bei xfbd1009a0cbb9842.x985dd08fd338eeea…ctor(x5e36356bc92c609b updateContext)
bei xfbd1009a0cbb9842.x5e36356bc92c609b.x496cb6c60c307cd1()
bei Aspose.Words.Fields.Field.x295cb4a1df7a5add(x5e36356bc92c609b x0f7b23d1c393aed9)
bei xfbd1009a0cbb9842.xfedf115fd9c03862.x4e3cfc222c92cda7(Field xe01ae93d9fe5a880, x5e36356bc92c609b x0f7b23d1c393aed9)
bei xfbd1009a0cbb9842.xfedf115fd9c03862.x4e3cfc222c92cda7(Field xe01ae93d9fe5a880)
bei xfbd1009a0cbb9842.xbf9ddf72e1283af9.x18dfca7c5fd2402f()
bei xfbd1009a0cbb9842.xfedf115fd9c03862.xdd6cf0348a23f220(xcf417e2db4fe9ed3 xe00c282e1a49fcfb)
bei xfbd1009a0cbb9842.xfedf115fd9c03862.xdf269951086089ce(x6435b7bbb0879a04 xa942970cc8a85fd4)
bei xe86f37adaccef1c3.xc5c3f438428cb03b.xd01ea9131ba53b87(ArrayList x292b5f49fee42032, xfedf115fd9c03862 xcc5022025f73a533)
bei xe86f37adaccef1c3.xc5c3f438428cb03b.xdeeb682062ef79a5()
bei xe86f37adaccef1c3.xc5c3f438428cb03b.xd5da23b762ce52a2(MailMerge x2a99de81295e7f29, IMailMergeDataSource xef1769c4fe6ae4ca, Boolean xc9c7b90943167aed)
bei Aspose.Words.Reporting.MailMerge.Execute(IMailMergeDataSource dataSource)

Hi

Thanks for your request. Unfortunately, I cannot reproduce the problem on my side. Could you please provide a simple code or a datasource you are using to execute mail merge? I will check the issue and provide you more information.

Best regards,

I will try to give you a code smple as it is not that easy.

What I know is, that the problem is located in one of the if blocks besides <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowRevisions/>
<w:DoNotPrintRevisions/>
<w:DoNotShowMarkup/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>DE</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normale Tabelle"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Calibri","sans-serif"; mso-bidi-font-family:"Times New Roman";}

<![endif]–><span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”; color: black;” lang=“FR”>Nom de
naissance and <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowRevisions/>
<w:DoNotPrintRevisions/>
<w:DoNotShowMarkup/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>DE</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normale Tabelle"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Calibri","sans-serif"; mso-bidi-font-family:"Times New Roman";}

<![endif]–><span style=“font-size:11.0pt;font-family:
“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;mso-ansi-language:
FR;mso-fareast-language:FR;mso-bidi-language:AR-SA” lang=“FR”>Nom marital. Can you see some problem in the fieldcode?

is it possible that you can tell me what happens in the code fragment where the excception occures? Could be some node empty or such thing?

Hi

Thanks for your inquiry. It would be possible if I can reproduce the problem. But it is extremely difficult to tell you what is going wrong when I cannot reproduce the problem on my side.

Field codes in your template looks fine to me. So I suppose the problem is caused by data you are putting in your template or by preprocessing of your document (if you are performing some).

Best regards,