Opening Documents

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Programmers' Reference > Application API > Overview > Programming Languages > C# >

Opening Documents

The code snippets below (from the AutomateAuthenticDesktop example) show how two files are opened via two separate methods assigned to two buttons in the user interface. Both methods use the same Application API access mechanism: Documents.OpenFile(string, boolean).

 

The AutomateAuthenticDesktop example (see the file Form1.cs) is located in the C# folder of the API Examples folder:

 

Windows 7, Windows 8, Windows 10

C:\Users\<username>\Documents\
Altova\Authentic2019\Authentic

 

You can compile and run the project from within Visual Studio 2010/2012/2013/2015/2017.

 

 

Code snippet

 

       // Handler for the "Open OrgChart.pxf" button

      private void openOrgChart_Click(object sender, EventArgs e)

       {

          // Make sure there's a running Authentic Desktop instance, and that it's visible

           StartAuthenticDesktop_Click(null, null);

 

          // Open a sample file installed with the product.

           AuthenticDesktop.Documents.OpenFile(strExamplesFolder + "OrgChart.pxf", false);

       }

 

      // Handler for the "Open ExpReport.xml" button

      private void openExpReport_Click(object sender, EventArgs e)

       {

          // Make sure there's a running Authentic Desktop instance, and that it's visible

           StartAuthenticDesktop_Click(null, null);

 

          // Open a sample file installed with the product.

           AuthenticDesktop.Documents.OpenFile(strExamplesFolder + "ExpReport.xml", false);

       }

 

The file opened last will be the active file.

 


© 2019 Altova GmbH