【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.4.46.3 Worksheet::AttachPicture
Contents
Description
Attach a picture, from an image file, to a worksheet cell.
Syntax
BOOL AttachPicture( int nRow, int nCol, LPCSTR lpcszFileName, DWORD dwEmbedInfo = 0 )
Parameters
- nRow
- [input] zero-based row index of the cell to attach the picture to
- nCol
- [input] zero-based column index of the cell to attach the picture to
- lpcszFileName
- [input] pointer to the picture's file name
- dwEmbedInfo
- [input] bits, including EMBEDGRAPH_KEEP_ASPECT_RATIO, EMBEDGRAPH_IN_LABELS, EMBEDGRAPH_NO_RESIZE_CELL, EMBEDGRAPH_MEDIA
Note: new bit EMBEDGRAPH_MEDIA was added in Origin 2022 to allow inserting in new format that allow double-click to open in Image Window, while without this bit, the old way will insert as LeadBitmap and double-click will open to a Matrix Window
Return
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
Examples
EX1
//Attach a picture, from an image file, to a worksheet cell. void Worksheet_AttachPicture_Ex1() { Worksheet wks = Project.ActiveLayer(); if(!wks) return; string strImage = GetOpenBox("*.bmp"); if(strImage.IsEmpty()) //user canceled return; wks.AttachPicture(0, 0, strImage, EMBEDGRAPH_KEEP_ASPECT_RATIO | EMBEDGRAPH_MEDIA); //new method //wks.AttachPicture(0, 0, strImage); //old method before Origin 2022 }
Remark
See Also
Header to Include
origin.h