Automation 在c++;项目

Automation 在c++;项目,automation,c++-cli,openxml,Automation,C++ Cli,Openxml,如何在C++/CLi中调用DocumentFormat和其他相关对象,并将OpenXML作为添加到程序中的参考。我找不到任何关于如何调用这些对象的文档。“使用文档格式.OpenXML.PACK”在C++项目中提供错误,如下: " 1> cpp(7):错误C2143:语法错误:缺少“;”before“ 1> clitest.cpp(7):错误C2873:“DocumentFormat”:符号不能在using声明中使用 1> cpp(7):错误C2059:语法错误:'.' " 但是,我添加了Docu

如何在C++/CLi中调用DocumentFormat和其他相关对象,并将OpenXML作为添加到程序中的参考。我找不到任何关于如何调用这些对象的文档。“使用文档格式.OpenXML.PACK”在C++项目中提供错误,如下: " 1> cpp(7):错误C2143:语法错误:缺少“;”before“ 1> clitest.cpp(7):错误C2873:“DocumentFormat”:符号不能在using声明中使用 1> cpp(7):错误C2059:语法错误:'.' " 但是,我添加了DocumentFormat,作为我的项目的参考

问候
YogiK

C++命名空间语法使用::作为分隔符。此代码编译为:

#include "stdafx.h"
using namespace System;
using namespace DocumentFormat::OpenXml::Packaging; 

int main(array<System::String ^> ^args)
{
    WordprocessingDocument^ doc = WordprocessingDocument::Create("C:\\mydoc.xdoc",DocumentFormat::OpenXml::WordprocessingDocumentType::Document);    
}
#包括“stdafx.h”
使用名称空间系统;
使用名称空间DocumentFormat::OpenXml::Packaging;
int main(数组^args)
{
WordprocessingDocument^doc=WordprocessingDocument::Create(“C:\\mydoc.xdoc”,DocumentFormat::OpenXml::WordprocessingDocumentType::Document”);
}

非常感谢,工作顺利。奇怪的是,在我遇到的相关教程中没有提到它。