您的位置:首页 > 编程语言 > C语言/C++

用visual C++ 2008 速成版编写EXCEL程序--测试托管程序调用COM组件

2009-01-08 21:03 423 查看
一、新建一个CLR控制台项目

二、到项目属性的->通用属性->框架和引用里,添加新引用,选择COM,找到EXCEL和OFFICE引用,添加进来:

//-----------------------------------------------------------------------

// This file is part of the Microsoft .NET SDK Code Samples.

//

// Copyright (C) Microsoft Corporation. All rights reserved.

//

//This source code is intended only as a supplement to Microsoft

//Development Tools and/or on-line documentation. See these other

//materials for detailed information regarding Microsoft code samples.

//

//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY

//KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A

//PARTICULAR PURPOSE.

//-----------------------------------------------------------------------

#include "stdafx.h"

using namespace System;

using namespace System::Reflection; // For Missing.Value and BindingFlags

using namespace System::Runtime::InteropServices; // For COMException

using namespace Microsoft::Office::Core;

using namespace Microsoft::Office::Interop::Excel;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐