View2.Export(String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Exports the view to a file of the specified format.
public:
void Export(System::String ^ bstrURL, System::String ^ bstrFormat);
public void Export (string bstrURL, string bstrFormat);
abstract member Export : string * string -> unit
Public Sub Export (bstrURL As String, bstrFormat As String)
Parameters
- bstrURL
- String
The directory location that the exported view file will be written to.
- bstrFormat
- String
The type of file format to export to. The supported values are:"MHT" - Web Archive, single file format (.mht)"PDF" - Portable Document Format file (.pdf)"XPS" - XPS Document (.xps)
Implements
Examples
In the following example, the Export method of the ViewObject object is used to export the current view to the Portable Document Format file (.pdf) format.
View2 myView = (View2)thisXDocument.View;
myView.<span class="label">Export</span>(@"C:\MyView.pdf", "PDF");
Remarks
If used in a form that is not fully trusted, the Export method will return a "permission denied" error.
Because the bstrFormat
parameter was changed to support "PDF" and "XPS" values in Microsoft InfoPath, you must declare and cast to the View2 type to access this functionality. For more information, see How to: Use Object Model Members That Are Not Compatible with InfoPath 2003.
Note: You can save as a PDF or XPS file from a Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on Office Online.
Important: This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.