⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample9excel8.c

📁 用CVI实现的EXCEL自动化服务器演示i
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "sample9excel8.h"

HRESULT CVIFUNC Excel_GetProperty (CAObjHandle Object_Handle,
                                   ERRORINFO *Error_Info,
                                   unsigned int Property_ID,
                                   unsigned int Property_Type, void *Value)
{
    HRESULT result;

    result = CA_PropertyGet (Object_Handle, Error_Info, Property_ID,
                             Property_Type, Value);

    return result;
}

HRESULT CVIFUNC Excel_SetProperty (CAObjHandle Object_Handle,
                                   ERRORINFO *Error_Info,
                                   unsigned int Property_ID,
                                   unsigned int Property_Type, ...)
{
    HRESULT result;
    va_list args;

    va_start (args, Property_Type);

    result = CA_PropertySetV (Object_Handle, Error_Info, Property_ID,
                              Property_Type, args);

    va_end (args);

    return result;
}

HRESULT CVIFUNC Excel_SetPropertyByRef (CAObjHandle Object_Handle,
                                        ERRORINFO *Error_Info,
                                        unsigned int Property_ID,
                                        unsigned int Property_Type, ...)
{
    HRESULT result;
    va_list args;

    va_start (args, Property_Type);

    result = CA_PropertySetByRefV (Object_Handle, Error_Info, Property_ID,
                                   Property_Type, args);

    va_end (args);

    return result;
}

HRESULT CVIFUNC Excel_NewOLEObject (char *server, CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20818, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_CreateObjectByClassId (&clsid, server, objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_OpenOLEObject (char *fileName, char *server,
                                     CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20818, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_LoadObjectFromFileByClassId (fileName, &clsid, server,
                                             objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_ActiveOLEObject (char *server, CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20818, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_GetActiveObjectByClassId (&clsid, server, objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectBringToFront (CAObjHandle objectHandle,
                                             ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x8001025A, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectCopy (CAObjHandle objectHandle,
                                     ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x80010227, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectCopyPicture (CAObjHandle objectHandle,
                                            ERRORINFO *errorInfo,
                                            enum ExcelEnum_XlPictureAppearance appearance,
                                            enum ExcelEnum_XlCopyPictureFormat format)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_LONG, CAVT_LONG};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x800100D5, CAVT_EMPTY,
                              NULL, 2, paramTypes, appearance, format);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectCut (CAObjHandle objectHandle,
                                    ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x80010235, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectDelete (CAObjHandle objectHandle,
                                       ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x80010075, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectDuplicate (CAObjHandle objectHandle,
                                          ERRORINFO *errorInfo,
                                          CAObjHandle *returnValue)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x8001040F,
                              CAVT_OBJHANDLE, returnValue, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectSelect (CAObjHandle objectHandle,
                                       ERRORINFO *errorInfo, VARIANT replace)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_VARIANT};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x800100EB, CAVT_EMPTY,
                              NULL, 1, paramTypes, replace);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectSendToBack (CAObjHandle objectHandle,
                                           ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x8001025D, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectActivate (CAObjHandle objectHandle,
                                         ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x80010130, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectUpdate (CAObjHandle objectHandle,
                                       ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x800102A8, CAVT_EMPTY,
                              NULL, 0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_OLEObjectVerb (CAObjHandle objectHandle,
                                     ERRORINFO *errorInfo,
                                     enum ExcelEnum_XlOLEVerb verb)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_LONG};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x8001025E, CAVT_EMPTY,
                              NULL, 1, paramTypes, verb);

    return result;
}

HRESULT CVIFUNC Excel_NewWorkbook (char *server, CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20819, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_CreateObjectByClassId (&clsid, server, objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_OpenWorkbook (char *fileName, char *server,
                                    CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20819, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_LoadObjectFromFileByClassId (fileName, &clsid, server,
                                             objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_ActiveWorkbook (char *server, CAObjHandle *objectHandle)
{
    HRESULT result;
    GUID clsid = {0x20819, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46};

    result = CA_GetActiveObjectByClassId (&clsid, server, objectHandle);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookActivate (CAObjHandle objectHandle,
                                        ERRORINFO *errorInfo)
{
    HRESULT result;

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x130, CAVT_EMPTY, NULL,
                              0, NULL);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookChangeFileAccess (CAObjHandle objectHandle,
                                                ERRORINFO *errorInfo,
                                                enum ExcelEnum_XlFileAccess mode,
                                                VARIANT writePassword,
                                                VARIANT notify)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_LONG, CAVT_VARIANT, CAVT_VARIANT};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x3DD, CAVT_EMPTY, NULL,
                              3, paramTypes, mode, writePassword, notify);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookChangeLink (CAObjHandle objectHandle,
                                          ERRORINFO *errorInfo, char *name,
                                          char *newName,
                                          enum ExcelEnum_XlLinkType type)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_CSTRING, CAVT_CSTRING, CAVT_LONG};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x322, CAVT_EMPTY, NULL,
                              3, paramTypes, name, newName, type);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookClose (CAObjHandle objectHandle,
                                     ERRORINFO *errorInfo, VARIANT saveChanges,
                                     VARIANT filename, VARIANT routeWorkbook)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_VARIANT, CAVT_VARIANT, CAVT_VARIANT};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x115, CAVT_EMPTY, NULL,
                              3, paramTypes, saveChanges, filename,
                              routeWorkbook);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookColorsGet (CAObjHandle objectHandle,
                                         ERRORINFO *errorInfo, VARIANT index,
                                         VARIANT *returnValue)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_VARIANT};

    result = CA_InvokeHelper (objectHandle, errorInfo, 0x11E,
                              DISPATCH_PROPERTYGET, CAVT_VARIANT, returnValue,
                              1, paramTypes, index);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookColorsPut (CAObjHandle objectHandle,
                                         ERRORINFO *errorInfo, VARIANT index,
                                         VARIANT colors)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_VARIANT, CAVT_VARIANT};

    result = CA_InvokeHelper (objectHandle, errorInfo, 0x11E,
                              DISPATCH_PROPERTYPUT, CAVT_EMPTY, NULL, 2,
                              paramTypes, index, colors);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookDeleteNumberFormat (CAObjHandle objectHandle,
                                                  ERRORINFO *errorInfo,
                                                  char *numberFormat)
{
    HRESULT result;
    unsigned int paramTypes[] = {CAVT_CSTRING};

    result = CA_MethodInvoke (objectHandle, errorInfo, 0x18D, CAVT_EMPTY, NULL,
                              1, paramTypes, numberFormat);

    return result;
}

HRESULT CVIFUNC Excel_WorkbookExclusiveAccess (CAObjHandle objectHandle,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -