1.11.2 Exporting Graphs

Origin allows users to export graphs to several different image file types. Origin C allows access to this ability using the global export_page and export_page_to_image functions.

The following example will export all the graphs in the project to EMF files. The EMF file names will be the same as the graph names, and will be located in the root of drive C.

string strFileName;
foreach(GraphPage gp in Project.GraphPages)
{
    strFileName.Format("c:\\%s.emf", gp.GetName());
    export_page(gp, strFileName, "EMF");
}

The next example will export the active graph to an 800x600 JPEG file. The JPEG file name will be the name of the graph and will be located in the root of drive C.

GraphPage gp;
gp = Project.ActiveLayer().GetPage();
if( gp ) // if active page is a graph
{
    string strFileName;
    strFileName.Format("c:\\%s.emf", gp.GetName());
    export_page_to_image(strFileName, "JPG", gp, 800, 600, 8);
}