Export View to a XPS file not working on XP computers.

  • Thread starter Mikael Andersson
  • Start date
M

Mikael Andersson

Hi

I have a form code connected to a button to automate creation of a xps file
from a view.

public void CTRL158_30_Clicked(object sender, ClickedEventArgs e)
{
string id =
root.SelectSingleNode("/my:myFields/my:LabTest/@my:Id",
NamespaceManager).Value;

Microsoft.Office.InfoPath.View rptView = this.CurrentView;

rptView.Export(@"\\Myserver\FTC LabTest Reports\Reports\" + id +
".xps", ExportFormat.Xps);
}

My problem is that this works fine on Vista and Windows 7 but not on XP.
(Same user and office version etc.)

The exporting seems to work ok (export message comes up ent the progress bar
gets all blue)

Then I get this error message on XP:

InfoPath has encountered an error. The operation failed.
InfoPath cannot export the form.
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.Export(String
bstrURL, String bstrFormat)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.Export(String
bstrURL, String bstrFormat)
at Microsoft.Office.InfoPath.Internal.ViewHost.Export(String
fileLocation, ExportFormat format)
at JBTLabTest.FormCode.CTRL158_30_Clicked(Object sender, ClickedEventArgs
e)
at
Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


Any help would be appreciated

Thanks
 
Joined
Apr 27, 2011
Messages
1
Reaction score
0
How did you deploy the code?

Hi Mikael,
Can you please provide me with more details regarding how did you deploy the code?
Was it used as code behind? If so, are there any particular references, includes or components that need to be included as part of the code?

Your help will be highly appreciated.

Thanks!

Hi

I have a form code connected to a button to automate creation of a xps file
from a view.

public void CTRL158_30_Clicked(object sender, ClickedEventArgs e)
{
string id =
root.SelectSingleNode("/my:myFields/my:LabTest/@my:Id",
NamespaceManager).Value;

Microsoft.Office.InfoPath.View rptView = this.CurrentView;

rptView.Export(@"\\Myserver\FTC LabTest Reports\Reports\" + id +
".xps", ExportFormat.Xps);
}

My problem is that this works fine on Vista and Windows 7 but not on XP.
(Same user and office version etc.)

The exporting seems to work ok (export message comes up ent the progress bar
gets all blue)

Then I get this error message on XP:

InfoPath has encountered an error. The operation failed.
InfoPath cannot export the form.
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.Export(String
bstrURL, String bstrFormat)
at
Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.Export(String
bstrURL, String bstrFormat)
at Microsoft.Office.InfoPath.Internal.ViewHost.Export(String
fileLocation, ExportFormat format)
at JBTLabTest.FormCode.CTRL158_30_Clicked(Object sender, ClickedEventArgs
e)
at
Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


Any help would be appreciated

Thanks
--
Mikael Andersson
Sr IT Architect
JBT FoodTech
 
F

Ferran Boladeres

Hi Mikael,

I am also having the same issue and I cannot find the original cause. Would you be so kind to share how you got to solve the issue?

Thanks in advance,

Ferran
 
Top