LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

save panel as picture

Hi,
 
is it possibale to save panel to picture?
 
anf if it is, please give me the command to use..
 
thanks
sruly
0 Kudos
Message 1 of 14
(4,687 Views)

Hello Sruly,

You should check out the Bitmap Library (part of the User Interface Library). There you can find the function GetPanelDisplayBitmap, which creates a bitmap from your panel. When the bitmap is created, you can save it to a bmp, jpeg or png file, using SaveBitmapToBMPFile, SaveBitmapToJPEGFile or SaveBitmapToPNGFile. These functions are also in this library.

Good Luck,

Wim

Message 2 of 14
(4,675 Views)
Thank you' it worked ..
 
I have another question, I need to put the picture at the end of range.
 
The insert picture command put the picture according to TOP parmeter.
 
do you a way to know execly the TOP parmeter that set the picture at the end of a range?
 
Thanks..
0 Kudos
Message 3 of 14
(4,651 Views)
Hi sruly,

What exactly are you trying to accomplish and what do you mean by "end of range" in this context?

Regards,
0 Kudos
Message 4 of 14
(4,633 Views)

Sruly,

If by "end of range" you mean the screen size or the panel size you can use GetScreenSize (to get your Windows desktop size) or GetPanelAttribute (with top, left, height, width attributes) to read the values and then use SetPanelPos (to position your panel on the Windows desktop) or SetCtrlAttribute (again with top, left, height, width attributes) to position a control (a picture button for example) within your panel.

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 14
(4,619 Views)
Oh, I am sorry, I didn't explain my self like i suppose to..
 
I mean by "end of range" that in E x c e l  I set range of data and i want to enter the picture after that range.
 
The command "Excel_InsertPicture need "TOP" parameter , I dont know how to set this parameter according

the excel range.
 
Thanks..
0 Kudos
Message 6 of 14
(4,586 Views)
Hi Sruly,

There may be something buried in the Excel Active-X API to get the "point" position of a given cell, but I assume you are using the Excel Report instrument in CVI with ExcelRpt_InsertPicture?

Since pictures can exist anywhere in a worksheet (not necessarily at a given cell), The TOP and LEFT parameters are specified in points where 1 point = 1/72 inches. In order to get the number of points that a set number of fixed height cells occupy, you could use the ExcelRpt_GetCellRangeAttribute function with the ER_CR_ATTR_ROW_HEIGHT attribute. This will return the height in points of the first row in the cell range, which you could multiply for as many rows as needed. To insert the picture below the third row, your code might look like the following:

int CVICALLBACK excel (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    double rowHeight;
    CAObjHandle worksheetHandle;
    CAObjHandle workbookHandle;
    CAObjHandle excelAppHandle;
   
    switch (event)
    {
        case EVENT_COMMIT:
            ExcelRpt_ApplicationNew (VTRUE, &excelAppHandle);
            ExcelRpt_WorkbookOpen (excelAppHandle, "C:\\Book1.xls", &workbookHandle);
            ExcelRpt_GetWorksheetFromIndex (workbookHandle, 1, &worksheetHandle);
            ExcelRpt_GetCellRangeAttribute (worksheetHandle, "A1", ER_CR_ATTR_ROW_HEIGHT, &rowHeight);
            ExcelRpt_InsertPicture (worksheetHandle, "C:\\Blue hills.jpg", rowHeight * 3, 0, 640, 480);
           
            break;
    }
    return 0;
}


Regards,
Message 7 of 14
(4,565 Views)
Hi,
 
Thank's alot , it worked...
 
You are the best...
 
sruly...
 
 
0 Kudos
Message 8 of 14
(4,556 Views)

Hi,

I need your help for two more things..

1. I need the command to set "Page break" at excel thrue CVI, because when I print the Report it's cut...

2. I need the command to make "Footer" in Excel thrue CVI.

Thanks alot...

sruly

 

0 Kudos
Message 9 of 14
(4,535 Views)
Hi sruly,

The CVI Excel Report libary is a limited wrapper for the more generic Mircrosoft Excel ActiveX API. As such, the report library does not include wrapper functions to perform the specific tasks you are referring to. While CVI allows you to create an instrument* based on the functions exposed by the Excel ActiveX server, it is up to you as the developer to decide which functions to use and how/when to use them.

For further information about the Excel ActiveX server, please refer to the Excel MSDN documentation on microsoft.com.

*This instrument is loaded in CVI when you open the Excel Report library (if you have Office 2003, it will read "Microsoft Excel 11.0 Object Library")

Regards,
0 Kudos
Message 10 of 14
(4,501 Views)