0

I'm developing a GUI for Infopath. I'm using Microsoft Visual Studio Tools for Applications with C# as developing language. I have two views in my project, one is the result of the other. I'm getting problem with print button (as PDF): I'm trying to print the resulting view (modified over the first) from the editing one. What I got until now is a code that prints the current view. How can I print the second one !

public void PrintBtn_Clicked(object sender, ClickedEventArgs e)
    {
         this.CurrentView.Export("TestFileName.pdf", ExportFormat.Pdf);
    }

Thanks. Best regards.

cyberbrain
  • 639
  • 2
  • 6
  • 12

1 Answers1

1

looks like the Export method is only available on a View object and unfortunately InfoPath des not expose a view collection for you. I think your best bet would probably be to switch to the view you want to print via

ViewInfos.SwitchView("view name");

Then you can do your call to export. Then finally you can switch back to the previous view if required...

I would expect this to flick up the second view for the user for a moment while the export is taking place but I can't test it because I'm in an an airport :p

Dave Williams
  • 2,166
  • 19
  • 25
  • That is exactly my actual approach ! I hoped that someone maybe has some trickier way ! Thank you for your confirmation ... I will tag your answer as accepted ! – cyberbrain Oct 19 '13 at 09:39