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 #