InfoPath 2007 Export Automation - InfoPath Dev
in

InfoPath Dev

InfoPath 2007 Export Automation

Last post 04-19-2011 03:42 PM by Greg Collins. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-28-2007 12:45 AM

    • asms
    • Not Ranked
    • Joined on 03-28-2007
    • Posts 1

    InfoPath 2007 Export Automation

    Hi,
    I am trying to automate InfoPath 2007 PDF export operation in a windows application.
    I am using a FormControl to open an InfoPath form and then do the export using

    FormControl1.XmlForm.CurrentView.Export("C:\myForm.pdf", format)

    this sometimes works and sometimes gives an exception. Here I cant figure out a pattern :-(

    InfoPath has encountered an error. The operation failed.

    InfoPath cannot export the form.
    The parameter is incorrect.


    Could anyone help me figure out what is going wrong here?
    Thanks in advance
    ASMS
  • 03-28-2007 10:40 AM In reply to

    Re: InfoPath 2007 Export Automation

    I've never used this feature yet, but due to the randomness, a wild-guess would be to check whether having errors in the form might be the source of your trouble (i.e. required fields not being filled in). I wouldn't expect this to be a problem, but hey--you never know!
  • 02-02-2010 11:22 AM In reply to

    • RW5207
    • Not Ranked
    • Joined on 09-21-2007
    • Posts 2

    Re: InfoPath 2007 Export Automation - Export as PDF

    I am using currentview.export to export the current view of the form to a pdf file.  I have been having mixed results.  Sometimes it works, other times I get an error.  The error I'm getting at the moment, and displaying in a message box is

    "InfoPath has encountered an error.  The operation failed."

    "InfoPath cannot export the form."

    "The process cannot access the file because it is being used by another process."

    The filename I'm exporting to is C:\InfoPath\TestForm.pdf.  I thought at first I encountered a filename length limitation of some sort, because it was failing every time I exported a file whose name was > 40 characters.  Now, however, I'm getting the error on short file names.

    I have created a very simple form with nothing on it except a text box and a few buttons.  I can debug the code and catch the error in the code:

    this.CurrentView.Export(xpsFormName, ExportFormat.Pdf);

    The xpsFormName variable shows that it has a valid filename.  Overall, it should be pretty simple.  I'm just wondering why, at times (now more often) I'm getting this error.  I'm also programmatically writing the XML file to the same folder and that is working just fine.  It appears to be something unique to the export as PDF function (yes, I have the extension installed).

    Full trust is selected, the form is digitially signed and it works sometimes. 

    Could it be that it's having a problem loading the assembly that provides the conversion?

     

  • 03-23-2011 03:07 PM In reply to

    Re: InfoPath 2007 Export Automation

    Thanks for the smack upside the head - we did indeed have validation errors in the UNSAVED (we would have found it in the client app when we tried to save) form, from which we tried to PDF a view.

    nsy

     

    -Nancy
  • 04-19-2011 03:42 PM In reply to

    Re: InfoPath 2007 Export Automation

     Glad we could help you.

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.