How to Set Word Document Properties with C #

Source: Internet
Author: User

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 the This post, the I want to introduce a method of about "to" set Word document properties with C # via Spire.doc.

Create Word documentdocument document = new Document ();d ocument. Builtindocumentproperties.title = "Document Properties";d ocument. Builtindocumentproperties.subject = "Demo";d ocument. Builtindocumentproperties.author = "S.W";d ocument. Builtindocumentproperties.company = "E-iceblue";d ocument. Builtindocumentproperties.manager = "H.H";d ocument. Builtindocumentproperties.category = "Document Setting";d ocument. Builtindocumentproperties.keywords = "property, Setting, Word";d ocument. Builtindocumentproperties.comments = "This was just an example."; Section section = document. AddSection (); 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 is 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 T/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 version appears to be branded as Microsoft Word," + "once again. The current versions is Microsoft Word for Windows and 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 #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.