CurrentView.Export not triggering until exit - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

CurrentView.Export not triggering until exit

Last post 10-22-2012 02:38 PM by idleloop. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-15-2012 03:16 PM

    CurrentView.Export not triggering until exit

    I am having a problem with exporting to PDF from InfoPath 2010 Filler. It appears that the call to CurrentView.Export("c:\Temp",ExportFormat.PDF) is not executing until I exit the method that it is called from.

    The exported file (and the progress bar) is not appearing until I exit the method, and hence the file is not available to subsequent code.

    Is this a known problem?

    Has anyone found a solution?

    I am trying to export a PDF file and then send the filename to a custom web service that will do some further processing, but the web service cannot find the file  as it is called in the same method and the file is not being created until I exit the method.

    Dim formAssessmentNo As System.Xml.XPath.XPathNavigator = nav.SelectSingleNode("/my:AddressChangeData/@my:AssessmentNumber", Me.NamespaceManager)
    Dim formPdfFilename As System.Xml.XPath.XPathNavigator = nav.SelectSingleNode("/my:AddressChangeData/my:PdfFilename", Me.NamespaceManager)

    Dim fileName As String = String.Format("{0}.pdf", formAssessmentNo.Value.ToString)
    Dim filePath As String = String.Format("{0}\{1}", "\\ServerName\Testing", fileName)

    formPdfFilename.SetValue(filePath)

    If System.IO.File.Exists(filePath) Then System.IO.File.Delete(filePath)
    Me.CurrentView.Export(filePath, ExportFormat.Pdf)

    Dim ws As WebServiceConnection = Me.DataConnections("SendEmailAttachment")
    ws.Execute()

  • 10-19-2012 03:33 PM In reply to

    Re: CurrentView.Export not triggering until exit

    Hi - when is this executing? Just on a button click?
    Hilary Stoupa
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-21-2012 03:03 PM In reply to

    Re: CurrentView.Export not triggering until exit

    The code is executing in a button click. An export of the form in xml works, but the pdf will not execute until the button click event exits. It is as if the pdf export is async.

    The short term solution I have employed is to display a message after the button click and before the form close. This appears to be working, but is not an ideal solution as I would like to run code in the event handler after the pdf export.

  • 10-21-2012 04:16 PM In reply to

    Re: CurrentView.Export not triggering until exit

     Is the problem happening when the file with the same name exists and there is a delay for deleting a file?

    You could try to run checking that file exists in loop until it is deleted.

    Also, it can be runtime optimization so you can try to declare involved variables as volatile.

    idleloop:
    The short term solution I have employed is to display a message
     

    You mean to dispaly a Message in a MessageBox?

    So, it is in a Filler/client Infopath form? or you are exporting from browser?

    This could be caching issues though I do not understand where yiu run the form.

     

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 10-21-2012 04:28 PM In reply to

    Re: CurrentView.Export not triggering until exit

    This is a Filler/Client form, not browser.

    The problem is happening regardless of the existence of the target pdf file.

    In order to get around the problem, I have put a submit button on the form with "Show message if the form is submitted successfully" checked. Then I have put the code in the Submit Event nof the form.

    When the code is on a button event (not a submit button), the call to Export runs, but the actual export does not occur until the code exits the event handler. It is at this point that the "exporting file" progress bar flashes up. If I put a close form (after the pdf export) before I exit the handler, the export never runs. 

  • 10-21-2012 06:28 PM In reply to

    Re: CurrentView.Export not triggering until exit

    idleloop:
    If I put a close form (after the pdf export) before I exit the handler, the export never runs
     

    this seems to me quite logical because the event handler is not finalized (and could have been changing the form itself).

    Why don't you generate PDF before the click?

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 10-22-2012 02:38 PM In reply to

    Re: CurrentView.Export not triggering until exit

    Gennady Vanin (Геннадий Ванин, Новосибирск):

    Why don't you generate PDF before the click?

    The whole point of the click is to generate the PDF! The button is literally the "Generate PDF Button".

    The only way that I can see to get the PDF is to have two buttons on the form, one to generate the PDF, and another to do the PDF processing. This is not an ideal solution from a user perspective as it would be much better to have a single button that initiated all of the appropriate processing.

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