/*------------------------------------------------------------------------------* * File Name: ExportAllGraphsToBMP.c * * Creation: ER, 01/28/05 * * Purpose: Programming Example * * Copyright (c) OriginLab Corp.2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 * * All Rights Reserved * * * * Modification Log: * *------------------------------------------------------------------------------*/ #include ///////////////////////////////////////////////////////////////////////////////// // This example shows how to export all graphs in current project to BMP files // with specific width, height etc. settings. // void export_all_graphs_to_BMP() { foreach( PageBase pgb in Project.Pages ) { // if graph page if( EXIST_PLOT == pgb.GetType() ) { GraphPage gp(pgb); // Export format string strFormat = "BMP"; // Width in pixels int nWidth = 1024; // Get page properties and set height appropriately to // maintain aspect ratio GraphPage gpg = pgb; int nHeight = (int) (nWidth * gpg.Dimension.Height.dVal / gpg.Dimension.Width.dVal); // Bits per pixel int nBitsPerPixel = 8; // Set export file path to be in the User Files folder - change as desired string strImagePath = GetAppPath() + gpg.GetName() + ".BMP"; printf("File: %s\n", strImagePath); // Call function to export page with desired settings BOOL bRet = export_page_to_image(strImagePath, strFormat, gp, nWidth, nHeight, nBitsPerPixel); // Report on error if( !bRet ) printf("Failed to export graph page: %s\n", pgb.GetName()); } } } /////////////////////////////////////////////////////////////////////////////////