-
CLR C++ Set Word CustomDocumentProperties
-
- #include "stdafx.h"
-
- using namespace System;
- using namespace System::Reflection;
- #define Office Microsoft::Office
- #define Word Office::Interop::Word
- #define Core Office::Core
-
- int main(array<System::String ^> ^args)
- {
- Word::Application^ wdApp = gcnew Word::Application();
- wdApp->Visible = true;
- Object^ missing = Type::Missing;
- String^% FileName =
- gcnew String("C:\Users\v-yangxu\Desktop\Work\1212030001.docx");
- Boolean^% flag = gcnew Boolean(false);
- Object^ m = Type::Missing;
- Word::Document^ wdDoc = wdApp->Documents->Open(FileName,m,flag,m,m,m,m,m,
- m,m,m,m,m,m,m,m);
- Object^ cps = wdDoc->GetType()->InvokeMember("CustomDocumentProperties",
- BindingFlags::Default | BindingFlags::GetProperty,
- nullptr,wdDoc,nullptr);
- Type^ type = cps->GetType();
- array<Object^>^ oargs = {"MyAttribute",false,
- Core::MsoDocProperties::msoPropertyTypeString,"Just a test"};
- try{
- type->InvokeMember("Add",
- BindingFlags::Default | BindingFlags::InvokeMethod, nullptr,
- cps, oargs );
- }catch(Exception^ ex){
- Console::WriteLine(ex->Message);
- }
- Console::ReadKey();
- return 0;
- }
-
相关阅读:
前端性能优化 —— reflow(回流)和repaint(重绘)
前端性能优化 —— 文档在浏览器中的加载和渲染
前端性能优化 —— 起步篇(一)
zepto源码研究
zepto源码研究
zepto源码研究
zepto源码研究
zepto源码研究
zepto源码研究
zepto源码研究
-
原文地址:https://www.cnblogs.com/Alex80/p/4349775.html
Copyright © 2020-2023
润新知