📄 wksheet.h
字号:
*/
MatrixLayer(Layer & layer);
/**#
Sets the display format of the data in the matrix
Parameters:
nDisplay =
numOfDigits = number of digits allowed in each element
numofDecimals = number of decimals allowed in each element
Return:
TRUE for success; otherwise FALSE
Example:
MatrixLayer mm("Matrix1");
printf("The matrix cell width is %d\n", mm.GetCellWidth());
*/
BOOL SetDataDisplay(int nDisplay, uint numOfDigits, uint numOfDecimals);
/**
Get the matrix cell width
Parameters:
None.
Return:
The matrix cell width
Example:
MatrixLayer mm("Matrix1");
mm.SetDataDisplay(1,2,3);
printf("The matrix cell width is %d\n", mm.GetCellWidth());
*/
uint GetCellWidth();
/**
Set the matrix cell width
Parameters:
nCellWidth = The width of the cell
Return:
TRUE for success; otherwise FALSE.
Example:
MatrixLayer mm("Matrix1");
mm.SetCellWidth(5);
*/
BOOL SetCellWidth(uint nCellWidth);
/**
Get matrix internal data type
Parameters:
None.
Return:
Internal data type of matrix
SeeAlso:
MatrixLayer::SetInternalData
Example:
MatrixLayer mm("Matrix1");
mm.SetInternalData(FSI_BYTE);
ASSERT( mm.GetInternalData() == FSI_BYTE );
*/
UINT GetInternalData();
/**
Set all matrix objects in layer to FSI_DOUBLE, FSI_BYTE and etc.
Remarks:
If matrix is already the correct internal type, this function will do nothing. If the matrix only has image without data,
bSaveData set to TRUE will convert the image into data so that HasData will become TRUE after this command.
Parameters:
iType = FSI_* constants defined in oc_const.h
bSaveData = whether to backup the data before type change and attempt to restore afterwords.
Set this to FALSE if you don't need the data in the matrix to make this operation faster.
Example:
MatrixLayer mm("Matrix1");
mm.SetInternalData(FSI_USHORT); // make Matrix1 ushort and keep its data and show as data
SeeAlso:
MatrixLayer::GetInternalData
*/
BOOL SetInternalData(UINT iType, BOOL bSaveData=TRUE, BOOL bSetViewData = TRUE);
/**
Set the number of columns in a MatixLayer.
Example:
MatrixLayer ml("Matrix1");
ml.SetNumCols(50);
Parameters:
nCols=Input number of columns to set
Return:
Returns TRUE on successful exit and FALSE on failure.
SeeAlso:
Datasheet::GetNumRows, Datasheet::SetNumRows, Datasheet::GetNumCols
*/
BOOL SetNumCols(uint nCols); // Set the number of columns in a MatixLayer.
#if _OC_VER > 0x0703
/**
Create a copy of the matrix window matlayerSource and attaches it to the object.
Argument:
matlayerSource = the matrix whose copy is made
nOption = enum {
CREATE_TEMP = 0, // it will be destroyed when destroying the object (when it exits the scope) and is created invisible
CREATE_VISIBLE_SAME, // visibility is that of the source matrix
CREATE_VISIBLE, // create visible
CREATE_HIDDEN, // create hidden
};
DWORD dwCtrl = enum {
DCTRL_COPY_DATA = 0x00000001, // copy data from source worksheet
DCTRL_COPY_IN_OPERATIONS = 0x00000002, // copy operations that have MatrixLayer as output (incoimng operations)
DCTRL_COPY_OUT_OPERATIONS = 0x00000004, // copy operations that have MatrixLayer as input (outgoing operations)
DCTRL_COPY_DEFAULT = DCTRL_COPY_DATA | DCTRL_COPY_OUT_OPERATIONS,
}
Return:
TRUE for success; otherwise FALSE.
Example:
void matrix_copy()
{
MatrixLayer mat;
MatrixLayer matSource("Matrix1");
int nOption = CREATE_VISIBLE_SAME;
BOOL bRet = mat.CreateCopy(matSource, nOption);
out_int("bRet = ", bRet);
}
SeeAlso:
DataSheet::Create, Worksheet::CreateCopy
*/
BOOL CreateCopy(MatrixLayer &matlayerSource, int nOption = CREATE_VISIBLE_SAME, DWORD dwCtrl = DCTRL_COPY_DEFAULT);
#else //_OC_VER > 0x0703
/**
Create a copy of the matrix window matlayerSource and attaches it to the object.
Argument:
matlayerSource = the matrix whose copy is made
nOption = enum {
CREATE_TEMP = 0, // it will be destroyed when destroying the object (when it exits the scope) and is created invisible
CREATE_VISIBLE_SAME, // visibility is that of the source matrix
CREATE_VISIBLE, // create visible
CREATE_HIDDEN, // create hidden
};
Return:
TRUE for success; otherwise FALSE.
Example:
void matrix_copy()
{
MatrixLayer mat;
MatrixLayer matSource("Matrix1");
int nOption = CREATE_VISIBLE_SAME;
BOOL bRet = mat.CreateCopy(matSource, nOption);
out_int("bRet = ", bRet);
}
SeeAlso:
DataSheet::Create, Worksheet::CreateCopy
*/
BOOL CreateCopy(MatrixLayer &matlayerSource, int nOption = CREATE_VISIBLE_SAME);
#endif //_OC_VER > 0x0703
/**
Check if MatrixLayer has associated image to be used in View Image mode.
Return:
TRUE if matrix has image
Example:
MatrixLayer mm("Matrix1");
if (mm.HasImage())
printf("Matrix has image\n");
else
printf("Matrix has NO image\n");
SeeAlso:
MatrixLayer::HasData
*/
BOOL HasImage();
/**
Check if MatrixLayer has data that represent the image one sees in the View Image mode.
An image can be loaded into a MatrixLayer and viewed as an image, and the associated matrix data
is not constructed until needed, to minimize memory consumption.
Return:
TRUE if matrix has data, return FALSE if matrix only has image but data not yet created
Example:
MatrixLayer mm("Matrix1");
if (mm.HasData())
printf("Matrix has Data\n");
else
printf("Matrix has NO Data\n");
SeeAlso:
MatrixLayer::HasImage
*/
BOOL HasData();
/**
Parameters:
bSetViewImage = TRUE to set matrix as View Image mode, FALSE to set matrix as View Data mode
Return:
TRUE if success; otherwise FALSE
Example:
MatrixLayer mm("Matrix1");
Matrix MM("Matrix1");
MM.SetSize(32,32);
MM = 20;
mm.SetViewImage(TRUE);
*/
BOOL SetViewImage(BOOL bSetViewImage = TRUE);
#ifdef ORIGIN_COM_SUPPORT
/**
It puts the data from an SPC blob into the matrix
Remarks:
This function is available only for OriginPro versions, or with a special COM enabled license
Argument:
varBlob = the VARIANT blob containing the data
Return:
TRUE for success; otherwise FALSE
Example:
void blob_to_matrix()
{
Object oSpcIO;
string strPathName = "E:\\myfile.spc";
oSpcIO = CreateObject("GSpcIOLib.GSpcIO"); // the GRAMS object used for importing the SPC file
oSpcIO.OpenFile(strPathName);
_VARIANT varBlob;
varBlob = oSpcIO.SaveBlob();
MatrixLayer mm("Matrix1");
BOOL bRet = mm.PutSPCBlob(varBlob);
out_int("Return value from PutSPCBlob is ", bRet);
}
*/
BOOL PutSPCBlob(_VARIANT &varBlob);
#endif //#ifdef ORIGIN_COM_SUPPORT
/**
Opens a new matrix from the supplied OGM file and attaches it to the object.
Parameters:
lpcszTemplate = the OGM file name
nOption = enum {
CREATE_TEMP = 0, // it will be destroyed when destroying the object (when it exits the scope) and is created invisible
CREATE_VISIBLE_SAME, // visibility is that which is stored in the OGM file
CREATE_VISIBLE, // create visible
CREATE_HIDDEN, // create hidden
};
Return:
TRUE for success; otherwise FALSE.
Example:
void matrix_open()
{
MatrixLayer mat;
string strOGM = "c:\\c\\vc32\\junk1.ogm";
int nOption = CREATE_VISIBLE_SAME;
BOOL bRet = mat.Open(strOGM, nOption);
out_int("bRet = ", bRet);
}
*/
BOOL Open(LPCSTR lpcszFileName, int nOption = CREATE_VISIBLE);
/**#
Copies part of image from another matrix layer
Argument:
SrcLayer = source matrix layer
left, top, right, bottom = rectangle in the source matrix layer to copy image from
Return:
TRUE if success; otherwise FALSE
Example:
void run_CopyImage()
{
MatrixLayer ml("Matrix1"); //Assume Matrix1 contain data
if( !ml )
return;
MatrixPage mpCpy;
mpCpy.Create("origin.otm");
MatrixLayer mlCpy = mpCpy.Layers();
if(mlCpy)
{
BOOL bOK = mlCpy.CopyImage(ml, 0, 0, ml.GetNumCols(), ml.GetNumRows() , FALSE);
if(mlCpy.HasImage())
{
mlCpy.SetViewImage(TRUE);
}
}
}
*/
BOOL CopyImage(MatrixLayer SrcLayer, int left, int top, int right, int bottom, BOOL bUndo = TRUE);
/**#
Copies part of image from another matrix layer
Argument:
SrcLayer = source matrix layer
grObject = closed graphic object (polygon, rectangle or circle)
Return:
TRUE if success; otherwise FALSE
Remarks:
It copies only the part of image in source matrix layer that is within grObject
*/
BOOL CopyImage(MatrixLayer SrcLayer, GraphObject grObject, BOOL bUndo = TRUE);
/**#
*/
MatrixObject MatrixObjects(int ObjIndex = -1);
/**#
*/
Collection<MatrixObject> MatrixObjects;
};
/** >Internal Origin Objects
The Column class provides methods and properties common to Origin worksheet
columns. An Origin C Worksheet object has a collection of Column objects each
of which in turn holds a Dataset. A Column object is primarily used for style
related control of the data in the associated Dataset. An Origin C Column object
is a wrapper object that is a reference to an internal Origin column object.
Wrapper objects do not actually exist in Origin and merely refer to the internal
Origin object. Consequently, multiple Origin C wrapper objects can refer to the
same internal Origin object. The Column class is derived from the DataObject,
DataObjectBase, and OriginObject classes from which it inherits methods and
properties.
Example:
Worksheet wks = Project.ActiveLayer();
if(!wks)
return;
int ii = 1;
foreach(Column cc in wks.Columns)
{
string strLabel;
if(cc.GetLabel(strLabel) > 0)
printf("Column(%d) has label = %s\n",ii++, strLabel);
}
*/
class Column : public DataObject
{
public:
/**
Remarks:
Default constructor for Column class
Parameters:
None
Return:
None
Example:
void test_Column_Column1()
{
Column colMy;
string strName;
colMy.Attach("Data1", 0);
if(colMy.IsValid())
{
colMy.GetName(strName);
out_str(strName);
}
}
*/
Column();
/**
Remarks:
Constructor that creates an Column object when given a column number in a worksheet.
Parameters:
lpcszWksName = name of the worksheet
iColNum = column number in the worksheet
Return:
None
Example:
void test_Column_Column2()
{
Column colMy("Data1", 0);
string strName;
if(colMy.IsValid())
{
colMy.GetName(strName);
out_str(strName);
}
}
*/
Column(LPCTSTR lpcszWksName, UINT iColNum);
/**
Remarks:
Constructor that creates an Column
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -