Can't find XMLForm in OM - InfoPath Dev
in

InfoPath Dev

Can't find XMLForm in OM

Last post 07-18-2007 10:06 AM by jlapegna. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 07-16-2007 08:35 AM

    Can't find XMLForm in OM

    Hello,

    I have a form created in InfoPath 2007, and I would like to add the functionality to print a specific view.

    I understand this is achieved through the XMLForm.PrintOut() method.  But I cannot seem to find an XMLForm object anywhere in the object model.  The 'this' object returns a the name of my .cs file (myForm.FormCode.cs), and it does not contain an XMLForms property like the SDK states exists.

    How can I get access to the XMLForm method so I can print a view?

     

    Thanks,

    Joey

  • 07-16-2007 09:06 AM In reply to

    Re: Can't find XMLForm in OM

    It's actually Print() in InfoPath 2007, not PrintOut(): http://msdn2.microsoft.com/En-US/library/aa944006(VS.80).aspx

    Also, your class that VS/VSTA generated for you derives drom XMLForm so you are XMLForm. As such, you simply say:

    this.Print()

    Hope this does it for you...

     

     

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-16-2007 10:24 AM In reply to

    Re: Can't find XMLForm in OM

    Yes, I actually tried that but when I call this.Print() I get the error

    Error 2 myForm.FormCode' does not contain a definition for 'Print'

    I am referencing Microsoft.Office.Infopath already.  When I output this.toString() i see "myForm.FormCode"

  • 07-16-2007 10:45 AM In reply to

    Re: Can't find XMLForm in OM

    Random guess:

    You are designing a form that is marked as Browser-compatible (i.e. it may run on the InfoPath Forms Server). When you are in this mode, several OM features are disabled since they make no sense on the server.

    If you are designing the form that is only intended to run on the client, simple change the compatibility settings via the Design Checker. If you intend the form to run only on the server, you cannot use Print() because IPFS has no way of triggering printing in the browser. Finally, if you intend to have it working in both client and server and if you expect Print to work only when you're running in the rich client, there are some hoops you could go through to get it to work. Hopefully this is not your case, though :)

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-16-2007 11:27 AM In reply to

    Re: Can't find XMLForm in OM

    ah, I see.  I am running the form in a browser only, and not in the infopath client.

    Is there any way to print a view from the browser with code?

  • 07-16-2007 12:15 PM In reply to

    Re: Can't find XMLForm in OM

    I would not think so - the code can only run on the server, no exceptions. If you hack around and get access to the printer, it will be one on your server which in most cases make no sense.

    Note that there is a print button in the browser-enabled forms - this is not good enough for you? The only thing that does run in the browser is javascript. Theoretically you could host the infopath form in your own ASPX page and run some custom javascript in it that would enable print scenarios. However this is pretty complicated and might not yield the desired results so I would say the short answer would be "no".

    If you still want to explore the hosting approach, you can check out this post: http://blogs.msdn.com/infopath/archive/2006/10/21/hosting-infopath-forms-in-a-custom-aspx-page.aspx

     

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-18-2007 10:06 AM In reply to

    Re: Can't find XMLForm in OM

    Thanks David.

     My reason for having a print button was because i didn't want to show the top (or bottom) forms services bar.  But I guess I will have to keep it and only display the print button.

     

    Thanks for the help.

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