thisXDocument is not declared?

A

AirDuster101

Hi,

I am using InfoPath 2007, trying to add print function to my browser form
(InfoPath Services). I am writing custom code in VB.NET. However, I don't
know where and how the "thisXDocument" should be declared in order to call

thisXDocument.PrintOut()

Thanks

AD
 
K

K.Ramana Reddy(GGK Tech)

Hi,

when you create the project using visual studio, by default it will defined
public void _Startup.

public void _Startup(Application app, XDocument doc)
{
thisXDocument = doc;
thisApplication = app;

// You can add additional initialization code here.
}

there is no need to define.
 
A

AirDuster101

Hi, but I am getting the error message that " name 'thisXDocument' is not
declared"... where should I look for public void_Startup? FYI, I am not
using full version of visual studio, just VSTO. I didn't have to create a
"project"...

AD
 
S

S.Y.M. Wong-A-Ton

In InfoPath 2007, this would be the Print() method or this.Print() if you're
using C# and Me.Print() if you're using VB.NET, but this method is not
available if your form template is browser-compatible, so cannot be used in
browser forms.
 
A

AirDuster101

.... I see. My form is browser-enabled and it has to stay that way. I notice
I can enable the "Print View" function on the form, but I don't want it to
show on every view of my form and when I click on it to print after data
entry, it keeps on messaging that you can't print until you click on the OK
to update. I don't have an ok button on the form. Is there anyway to
control this Print View function from programming code?

Much appreciation...

AD
 
S

S.Y.M. Wong-A-Ton

If you're referring to the "Print View" button on the toolbar of a form
running in Forms Services, you cannot get to it through code from within the
form itself, since it is driven by JavaScript and print functionality in a
component of Forms Server. I saw the OK you were referring to. That looks
like a bug to me. If you click OK and then click Print View again, it works.
It seems like it detects changes made on the form and somehow cannot print
without doing some update (a Postback to probably update the ViewState),
which it does when you click OK.

If you want to print a form from within the browser and not use the standard
print functionality offered by Forms Services, you will have host your forms
in your own ASP.NET page, add a button to your ASP.NET page, and write code
behind that button to print the form. I haven't yet found an easier way to do
it...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top