<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Views</title><link>https://www.infopathdev.com:443/forums/42.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28042.aspx</link><pubDate>Thu, 17 Apr 2008 17:31:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28042</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28042.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28042</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m out of ideas here. Unfortunately there are still a good number of things that InfoPath could improve upon to make this a more fully functional enviornment to develop in, and we are only on the 3rd release--so they are still getting good feedback from customers like yourself on things that are needed.&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28026.aspx</link><pubDate>Thu, 17 Apr 2008 13:59:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28026</guid><dc:creator>jmvdh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28026.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28026</wfw:commentRss><description>&lt;p&gt;Would it maybe be possible to temporarily open the print view in a dialog box or task pane or something in the background, and then export it from there?&amp;nbsp; Afterwards I could use code to close it and continue with the submit and close. I&amp;#39;m not sure how to do this...&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28024.aspx</link><pubDate>Thu, 17 Apr 2008 12:57:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28024</guid><dc:creator>jmvdh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28024.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28024</wfw:commentRss><description>&lt;p&gt;I tried that, and it does print the print view&amp;nbsp;when you print or print preview the form, but not when you export it.&amp;nbsp; I guess that is a 2007 feature only. My clients are all on 2003 still, so 2007 isn&amp;#39;t an option. If anyone has any other ideas, please let me know... Thanks.&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28020.aspx</link><pubDate>Thu, 17 Apr 2008 09:43:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28020</guid><dc:creator>Albert</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28020.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28020</wfw:commentRss><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;When calling the Export method from the CurrentView object in InfoPath 2007 the printview instead of the CurrentView is exported. This is undocumented (and unnatural imho)&amp;nbsp;behaviour.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know about InfoPath 2003, but you could try to specify a printview and not call &lt;em&gt;thisXDocument.View.SwitchView(&amp;quot;Print View&amp;quot;)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Might be worth a try :-)&lt;/p&gt;
&lt;p&gt;Albert&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28014.aspx</link><pubDate>Wed, 16 Apr 2008 21:01:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28014</guid><dc:creator>jmvdh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28014.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28014</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m calling my code from OnSubmitRequest, so I don&amp;#39;t think I can use it again.&amp;nbsp; Here is my current code.&amp;nbsp; How do I reuse OnSubmitRequest?&lt;/p&gt;
&lt;p&gt;&amp;lt;InfoPathEventHandler(EventType:=InfoPathEventType.OnSubmitRequest)&amp;gt; _&lt;br /&gt;Public Sub OnSubmitRequest(ByVal e As DocReturnEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; StartSubmit()&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;lt;InfoPathEventHandler(EventType:=InfoPathEventType.OnContextChange)&amp;gt; _&lt;br /&gt;Public Sub OnContextChange(ByVal e As DocContextChangeEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If mblnSubmit Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FinishSubmit()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;Private Sub StartSubmit()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mblnSubmit = True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisXDocument.View.SwitchView(&amp;quot;Print Version View 1&amp;quot;)&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;Private Sub FinishSubmit()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mblnSubmit = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisXDocument.View.Export(&amp;quot;c:\MHT\temp.mht&amp;quot;, &amp;quot;MHT&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisXDocument.DataAdapters.Item(&amp;quot;Main submit&amp;quot;).Submit()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseInfoPath()&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;Private Sub CloseInfoPath()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; On Error Resume Next&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisApplication.Quit(True)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisApplication.ActiveWindow.Close(True)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisApplication.XDocuments.Close(thisXDocument)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisXDocument.View.Window.Close(True)&lt;br /&gt;End Sub&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28013.aspx</link><pubDate>Wed, 16 Apr 2008 20:38:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28013</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28013.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28013</wfw:commentRss><description>&lt;p&gt;Argh! I missed that last statement. Unfortunately, the ONLY place you can perform a Window.Close() is in an OnClick and OnSubmitRequest handler. Although the help does not specificly suggest it, I think all the other Close() methods have the same restriction.&lt;/p&gt;
&lt;p&gt;However, since you are using the main submit, I think you might actually get the OnSubmitRequest event fired when you perform the submit. If that is the case, then you should be able to close it in that event handler. Convoluted--but hopefully it works!&lt;/p&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28012.aspx</link><pubDate>Wed, 16 Apr 2008 19:42:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28012</guid><dc:creator>jmvdh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28012.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28012</wfw:commentRss><description>&lt;p&gt;OnSwitchView gave me the same error as before, but OnContextChange almost worked. The swiching view and exporting works fine but now it won&amp;#39;t close the form.&amp;nbsp; I get an error: &amp;quot;Invalid context for OM call.&amp;quot;&lt;/p&gt;
&lt;p&gt;I tried all the following close commands and they all generate that error.&lt;/p&gt;
&lt;p&gt;thisApplication.Quit(True)&lt;br /&gt;thisApplication.ActiveWindow.Close(True)&lt;br /&gt;thisApplication.XDocuments.Close(thisXDocument)&lt;br /&gt;thisXDocument.View.Window.Close(True)&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Any more suggestions?&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/28007.aspx</link><pubDate>Wed, 16 Apr 2008 17:43:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28007</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28007.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=28007</wfw:commentRss><description>&lt;p&gt;InfoPath can be really picky about doing things at the same time you are switching views. When I say at the same time, I mean in one total transaction (all the rules and code the run as the result of a button click or whatever).&lt;/p&gt;
&lt;p&gt;As an example... you are trying to switch views and then export. Likely, if it works, your export will be the original edit view instead of the expected print view. Why? Because a view switch isn&amp;#39;t actually complete until control returns to the form (i.e. after all of the rules and code involved have completed).&lt;/p&gt;
&lt;p&gt;What you can do is to set some kind of a flag: fPerformSubmit = true, and then switch views. Then in the OnSwitchView event (or maybe it only worked in the OnContextChange event--I don&amp;#39;t recall which) you can perform your other functions if fPerformSubmit is true. When done, set it back to false.&lt;/p&gt;</description></item><item><title>Switch view before exporting and submitting</title><link>https://www.infopathdev.com:443/forums/thread/27996.aspx</link><pubDate>Wed, 16 Apr 2008 14:40:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27996</guid><dc:creator>jmvdh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27996.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=42&amp;PostID=27996</wfw:commentRss><description>&lt;p&gt;I have an InfoPath 2003 form that has two views (&amp;quot;data entry&amp;quot; and &amp;quot;print view&amp;quot;).&amp;nbsp; When I submit the form, I use code to switch to the &amp;quot;print view&amp;quot; before I export the form and submit it.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my code:&lt;/p&gt;
&lt;p&gt;thisXDocument.View.SwitchView(&amp;quot;Print View&amp;quot;)&lt;br /&gt;thisXDocument.View.Export(&amp;quot;c:\MHT\temp.mht&amp;quot;, &amp;quot;MHT&amp;quot;)&lt;br /&gt;thisXDocument.DataAdapters.Item(&amp;quot;Main submit&amp;quot;).Submit()&lt;br /&gt;thisApplication.Quit(True)&lt;/p&gt;
&lt;p&gt;Unfortunately I get this error:&lt;/p&gt;
&lt;p&gt;InfoPath cannot execute any view-related object model calls. The view is not ready.&lt;/p&gt;
&lt;p&gt;If I comment out the first line to switch the view it works.&amp;nbsp; Any suggestions?&lt;/p&gt;</description></item></channel></rss>