How to Set Word Document Properties with C#
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#的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 【转】How to view word document in WPF application
How to view word document in WPF application (CSVSTOViewWordInWPF) Introduction The Sample demonstra ...
- Document properties
http://devnet.kentico.com/docs/7_0/devguide/index.html?document_properties_overview.htm You can edit ...
- Microsoft.Office.Interop.Word.Document.Open returns null on Windows Server 2008 R2
系统终于通过UAT,可以上线了.一遍测下来还行,可是为什么word转PDF就是不行呢?查了一下log,原来在wordApp.Documents.Open来打开生产的word文件的时候,返回一直是空.之 ...
- word:Can't find the word document templant:WordToRqm.doc
问题:打开word文件时弹出提示 Cannot find the Word template:WordToRqm.dot 原因:安装了power designer. 解决:运行regedit.exe ...
- asp.net Word Document Open return null
- 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 ...
随机推荐
- sql执行超时处理
首先设置数据库的配置文件 看看效果 如果程序还是超时则在连接字符串中做出处理 不然程序会自动kind的连接进程 程序和数据库方面都要配置缺一不可
- gdb提示Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.2.x86_64
用gdb debugc代码的时候弹出这个错误 Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.2. ...
- C#序列化/反序列化
序列化:将实体类以二进制或者XML的形式保存到磁盘或者内存中. 反序列化:将序列化的二进制文件和XML文件解析成实体类. 例如下面的二进制序列化与反系列化: using System; using S ...
- SQL技巧之分组求和
这是CSDN问答里面有人提出的一道问题,题目如下. 表格如下: 得出结果如下: 求精简的SQL语句. SQL查询语句: with a as( select rank() over (partition ...
- C# 制作Zip压缩包
压缩包制作也是很多项目中需要用到的功能.比如有大量的文件(假设有10000个)需要上传,1个1个的上传似乎不太靠谱(靠,那得传到什么时候啊?),这时我们可以制作一个压缩包zip,直接传这个文件到服务器 ...
- AVFoundation 初识
AVFoundation是苹果 OS X系统和 iOS系统中用于处理基于时间的媒体数据的高级Objective-C框架. iOS中 AVFoundation 在整个体系中所处的角色
- python(二)基础
1.lambda表达式(一般格式为冒号前边是参数冒号后边是返回值) 单参数: 多参数: 我们如果实现一个普通的filter过滤函数过滤掉偶数: 而我们如果用lambda表达式就很简便: 2.递归 普通 ...
- [HTML]marquee标签属性详解
请大家先看下面这段代码:<marquee direction=upbehavior=scrollloop=3scrollamount=1 scrolldelay=10align=topbgcol ...
- C++ union 公共体
union myun { struct { int x; int y; int z; }u; int k; }a; int main() { a.u.x =; a.u.y =; a.u.z =; a. ...
- 2014年度辛星css教程夏季版第六节
这一节我们就要讲到布局了,其实布局本身特别简单,但是要合理的布好局就不那么简单了,就像我们写文章一样,写一篇文章非常简单,但是要写一篇名著就很难了,这需要我们扎实的功底和对文学的理解,但是,千里之行, ...