Print button in Custom Task Pane - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Print button in Custom Task Pane

Last post 02-10-2011 07:01 AM by Potemkine. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-21-2011 08:28 PM

    Print button in Custom Task Pane

     Hello folks!

     

    Would someone be so kind as to help me figure out how to add a button to a Custom Task Pane which will print all views? As well as having the print button I need it to be disabled or possibly throw an error message when the user tries to print a form that has required fields which are blank...???

     

    Thank you so much in advance! This is a big issue that I need to figure out.. 

     

    The most important portion of this request for help is the disabled print option if the user fails to fill in all required fields. If having that ability means I can't have the button in the Custom Task Pane then its a sacrifice I am able to make.

     

    Also, i understand this my require some coding to intercept the onPrint command or something like that and I am more than willing and able to work with code. I have experience programming in PHP/HTML and some JavaScript, VB and C++

     

    Thanks again!

     

    Jay

  • 01-22-2011 08:01 AM In reply to

    Re: Print button in Custom Task Pane

    Hi, I don't know if it's possible to do that from the task pane, and for printing all your views you can set "print multiple view" or create a view with all you differents views. On form options you can disable the print feature, so by default you can't print your form after that you add a button and add some code to print your form In c# coding it's: this.Print(); You can set some conditionnal formatting on your button to allow or not the print function. Hope it's helpfull.
  • 01-23-2011 04:34 PM In reply to

    Re: Print button in Custom Task Pane

     That's going to work.

     

    Thanks!

  • 02-09-2011 05:08 PM In reply to

    Re: Print button in Custom Task Pane

     Hello good folks...

     

    I am replying to this thread for a couple reasons...

     

    When I first tried this solution mentioned above, it worked. 

     

    Now it's not. When I tried to add the same line mentioned above for printing, the "this.Print();" line to the appropriate button but the code editor says that "this" is not declared.

     

    Also, I am curious what kind of "conditional formatting" I would have to do to prevent printing or disable the print option is there is a field left blank

  • 02-10-2011 12:25 AM In reply to

    Re: Print button in Custom Task Pane

    hi, for the "this.Print();" check that your coding langage is c# and not c#(compatible2003).For the "conditional formatting" right click on the button, select conditionnal formatting and and set some condition for instance if a field is blank you can hide or disabled your button.
  • 02-10-2011 06:35 AM In reply to

    Re: Print button in Custom Task Pane

     Hi, thanks for the quick reply!

     

    Edit: I found the place i need to change the  coding language but it presents a new problem as I have some VB coding which I have to have. I can fix this if I can find a way to export my form to PDF written in c#. Here is the VB code I have to export to PDF:

                Dim fileName As String
                Dim nameNode As XPathNavigator
                nameNode = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:SONumber", NamespaceManager)
                fileName = nameNode.Value + ".pdf"
                Me.CurrentView.Export("C:\Documents and Settings\Patron.A-102\My Documents\BookingPacket\CompletedPackets\" + fileName, ExportFormat.Pdf)

    I looked around the code editor and  I am not seeing a place where I check that my coding language is set correctly.

    Also, I right clicked on the button and it doesn't give me an option for conditional formatting

     

    I'm using InfoPath 2010

     

    I looked under the Control Tools Properties tab and I don't see anything there either. 

     

    Could you possibly elaborate a little for me? I don't quite follow.

     

    Thank you!

  • 02-10-2011 07:01 AM In reply to

    Re: Print button in Custom Task Pane

    Hi, on 2010 conditionnal formatting has merge with rules so select your button click on "Managed rules",  set a condition, and on rules types select formatting and disable or hide your control.

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