CLR C++ Set Word CustomDocumentProperties
- // WordIssue.cpp : main project file.
- #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;
- }
CLR C++ Set Word CustomDocumentProperties的更多相关文章
- WinForm小白的WPF初试一:从PropertyGrid控件,输出内容到Word(上)
学WinForm也就半年,然后转到WPF,还在熟悉中.最近拿到一个任务:从PropertyGrid控件,输出内容到Word.难点有: 一.PropertyGrid控件是WinForm控件,在WPF中并 ...
- .NET CLR 运行原理
原文: Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects 文章讨论了: SystemDoma ...
- C# 操作 Word 修改word的高级属性中的自定义属性2
word的类库使用的是word2007版本的类库,类库信息见下面图片,折腾了半天,终于找到入口,网上 很多说的添加或者修改word的高级属性中的自定义属性都是错误的,感觉都是在copy网上的代码,自己 ...
- C# 操作 Word 修改word的高级属性中的自定义属性
为 Microsoft Word 创建自动化客户端 启动 Visual Studio .NET. 在文件菜单上,单击新建,然后单击项目.从 Visual C# 项目类型中选择 Windows 应用程序 ...
- jacob 操作word
1. 首先下载jacob-1.18.zip,解压后有两个文件jacob.jar 和 jacob.dll.需要把jacob.jar放到你工程的classpath中并且把jacob.dll放到jdk的bi ...
- 深入探索.NET框架内部了解CLR如何创建运行时对象
原文地址:http://msdn.microsoft.com/en-us/magazine/cc163791.aspx 原文发布日期: 9/19/2005 原文已经被 Microsoft 删除了,收集 ...
- C# 如何更改Word语言设置
一般在创建或者打开一个Word文档时,如果没有进行过特殊设置的话,系统默认的输入语言的是英语输入,但是为适应不同的办公环境,我们其实是需要对文字嵌入的语言进行切换的,因此,本文将介绍如何使用免费版组件 ...
- VSTO:使用C#开发Excel、Word【14】
操作workbooks集合可从Application对象的Workbooks属性中获取的Workbooks集合包含当前在应用程序中打开的Workbook对象的集合. 它还具有用于管理开放工作簿,创建新 ...
- [.NET开发] C# 如何更改Word语言设置
一般在创建或者打开一个Word文档时,如果没有进行过特殊设置的话,系统默认的输入语言的是英语输入,但是为适应不同的办公环境,我们其实是需要对文字嵌入的语言进行切换的,因此,本文将介绍如何使用Spire ...
随机推荐
- [翻译][MVC 5 + EF 6] 5:Code First数据库迁移与程序部署
原文:Code First Migrations and Deployment with the Entity Framework in an ASP.NET MVC Application 1.启用 ...
- jtemplate使用笔记
最近的项目中用到了jtemplate, 它是客户端基于javascript的模板引擎,绑定的数据为json对象.以前我在页面上显示数据列表时最喜欢用Repeater控件了,因为它相对与其它几个服务端控 ...
- apache 工作模式
apache三种工作模式: prefork(2.4前默认)/worker/event(2.4默认)内容整理来自以下网站http://m.blog.csdn.net/article/details?id ...
- Android AndroidManifest学习笔记
<application>标签 : android:allowBackup="true" 数据可以备份 <activity>标签:configChanges ...
- JS 页面打印
var hkey_root, hkey_path, hkey_key hkey_root = "HKEY_CURRENT_USER" hkey_path = "\\Sof ...
- java StringBuffer与StringBuilder
StringBuffer:就是字符串缓冲区. * 用于存储数据的容器. * 特点: * 1,长度的可变的. * 2,可以存储不同类型数 ...
- jsoup 对网页中图片解析
Elements article = new Elements(); Elements Img = new Elements(); article = doc.select("div#con ...
- nginx 常用的 URL 重写方法
转自:http://www.jbxue.com/article/4727.html Nginx中一些常用的URL 重写方法介绍,有需要的朋友可以参考下.url重写应该不陌生,不管是SEO URL 伪静 ...
- 解决Genemotion 安装出现“Unable to start......”的问题
最近在用uiautomator做安卓自动化测试,由于没有测试设备,所以只好自己在电脑里面安装了一个GenyMotion模拟器,虽然速度不及真机,但是也算能解决大部分的需求. 安装完之后启动出现了以下错 ...
- 【DB】SQLiteHelper
/// <summary> /// 说明:这是一个针对System.Data.SQLite的数据库常规操作封装的通用类. /// </summary> public class ...