Word properties shows a brief description about one document. Through properties, we can learn general information about this document, such as document size, date to create and so on. Also, we can set advance properties by ourselves, for example, adding document title, author information. In this post, I want to introduce a method about how to set Word document properties with C# via Spire.Doc.

//Create word document
Document document = new Document(); document.BuiltinDocumentProperties.Title = "Document Properties";
document.BuiltinDocumentProperties.Subject = "demo";
document.BuiltinDocumentProperties.Author = "S.W";
document.BuiltinDocumentProperties.Company = "e-iceblue";
document.BuiltinDocumentProperties.Manager = "H.H";
document.BuiltinDocumentProperties.Category = "Document Setting";
document.BuiltinDocumentProperties.Keywords = "Property, Setting, Word";
document.BuiltinDocumentProperties.Comments = "This is just an example."; Section section = document.AddSection();
section.PageSetup.Margins.Top = 72f;
section.PageSetup.Margins.Bottom = 72f;
section.PageSetup.Margins.Left = 89.85f;
section.PageSetup.Margins.Right = 89.85f; String p1
= "Microsoft Word is a word processor designed by Microsoft. "
+ "It was first released in 1983 under the name Multi-Tool Word for Xenix systems. "
+ "Subsequent versions were later written for several other platforms including "
+ "IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), "
+ "Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989). ";
String p2
= "Microsoft Office Word instead of merely Microsoft Word. "
+ "The 2010 version appears to be branded as Microsoft Word, "
+ "once again. The current versions are Microsoft Word 2010 for Windows and 2008 for Mac.";
section.AddParagraph().AppendText(p1).CharacterFormat.FontSize = 14;
section.AddParagraph().AppendText(p2).CharacterFormat.FontSize = 14; //Save doc file.
document.SaveToFile("Sample.doc",FileFormat.Doc);

How to Set Word Document Properties with C#的更多相关文章

  1. How to open MS word document from the SharePoint 2010 using Microsoft.Office.Interop.dll

    or this you must change the identity of word component inC:\windows\System32\comexp.mscto be interac ...

  2. Adding Form Fields to a MS Word Document

    Configuring a Word Merge in SmartSimple is a three-step process: Create the MS Word document that wi ...

  3. Send an email with format which is stored in a word document

    1. Add a dll reference: Microsoft.Office.Interop.Word.dll 2. Add the following usings using Word = M ...

  4. 【转】How to view word document in WPF application

    How to view word document in WPF application (CSVSTOViewWordInWPF) Introduction The Sample demonstra ...

  5. Document properties

    http://devnet.kentico.com/docs/7_0/devguide/index.html?document_properties_overview.htm You can edit ...

  6. Microsoft.Office.Interop.Word.Document.Open returns null on Windows Server 2008 R2

    系统终于通过UAT,可以上线了.一遍测下来还行,可是为什么word转PDF就是不行呢?查了一下log,原来在wordApp.Documents.Open来打开生产的word文件的时候,返回一直是空.之 ...

  7. word:Can't find the word document templant:WordToRqm.doc

    问题:打开word文件时弹出提示 Cannot find the Word template:WordToRqm.dot 原因:安装了power designer. 解决:运行regedit.exe ...

  8. asp.net Word Document Open return null

  9. How to automate Microsoft Word to create a new document by using Visual C#

    How to automate Microsoft Word to create a new document by using Visual C# For a Microsoft Visual Ba ...

随机推荐

  1. Node安装与环境配置

    1.nodejs(npm)安装 下载nodejs(http://nodejs.cn/)安装后,cmd下如输入 node -v  与  npm -v 出现下图版本提示就是完成了NodeJS的安装 2.n ...

  2. OpenSUSE共享网络

    因为想要使用Arduino Ethernet扩展版,想要搭建一个局域网供其使用有线,无奈路由器离我太远.遂有本文. 实验器材: 装有OpenSUSE.有线网卡.无线网卡的笔记本. 路由器一台. 实验步 ...

  3. 51nod贪心算法入门-----活动安排问题2

    题目大意就是给几个活动,问要几个教室能够弄完. 这个题目的想法就是把活动的开始——结束的时间看做是数轴上的一段线段,教室的个数就是在某点的时间厚度,求最大的时间厚度就是所需要的教室个数. #inclu ...

  4. 如何让sudo命令不需要输入密码就可执行

    通过visudo 来编辑/etc/sudoers来实现 在该文件中追加一下记录即可 username ALL=(ALL) NOPASSWD:ALL ——-下面文章转载自网络———– # User pr ...

  5. osg 基本几何图元

    转自:osg 基本几何图元 //osg 基本几何图元 // ogs中所有加入场景中的数据都会加入到一个Group类对象中,几何图元作为一个对象由osg::Geode类来组织管理. // 绘制几何图元对 ...

  6. 使用Result代替ResultSet作为方法返回值

    在开发过程中,我们不能将ResultSet对象作为方法的返回值,因为Connection连接一旦关闭,在此连接上的会话和在会话上的结果集也将会自动关闭,而Result对象则不会发生这种现象,所以在查询 ...

  7. Shell面试题

    1.用Shell编程,判断一文件是不是块或字符设备文件,如果是将其拷贝到 /dev 目录下. #!/bin/bash#1.sh#判断一文件是不是字符或块设备文件,如果是将其拷贝到 /dev 目录下#f ...

  8. NSCharacterset

    我们在nsstring的分割,查找等操作中,经常会提供两种函数,参数类型分别为NSString 和NSCharacterset,有什么不同呢? NSString 是有序字符串 NSCharacters ...

  9. poj 2559 Largest Rectangle in a Histogram (单调栈)

    http://poj.org/problem?id=2559 Largest Rectangle in a Histogram Time Limit: 1000MS   Memory Limit: 6 ...

  10. JSP页面之${fn:}内置函数

    函数列表: 函数名 函数说明 使用举例 fn:contains 判断字符串是否包含另外一个字符串 <c:if test="${fn:contains(name, searchStrin ...