I have a C # WinForm application that (among other things) hosts an InfoPath FormControl to allow users to fill out some forms. The save method provided by WinForm, in addition to saving the XML form, also exports the form in PDF format so that a copy of the PDF can be sent by e-mail.
Everything worked fine when we used InfoPath 2007. Since the company is now updating all machines using Office, from 2007 to 2010 I need to update the application for working with InfoPath 2010. After changing the necessary links, everything seemed to work fine while the save function Did not try to export the form to PDF. The following is the code to export the form (which worked previously when using 2007):
this.view.OutputForm.XmlForm.CurrentView.Export(pdfFile, Microsoft.Office.InfoPath.ExportFormat.Pdf);
OutputForm - Microsoft.Office.InfoPath.FormControl object. When the Export method is called, this exception is thrown:
InfoPath has encountered an error. failed to complete the operation.
InfoPath cannot export the form. no supported interface
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.Export (String bstrURL, String strFormat)
at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.Export (String bstrURL, String bstrFormat)
at Microsoft.Office.InfoPath.Internal.ViewHost.Export (String fileLocation, ExportFormat format) ...
I canβt imagine that this functionality has just been torn from the hosted InfoPath 2010 FormControl, right? I really hope this is not the case.
Are there InfoPath wizards here that can point me in the right direction (what am I missing or an alternative solution)?
Based on the materials of Arthur Mustafin, I am open to listening to alternative solutions for creating PDF from the InfoPath form.
A note for anyone who came across this found this thread on social.msdn.microsoft.com , where Bruce Song states that:
... this is a known issue from Microsoft's internal error checking system and the product group is trying to fix it.