Office Programming is essential.
1. Official Microsoft instance:
Paragraphs, tables, and charts
How to: Use Visual C #. net to automatically create a document in Word
2. Learning Resources
(1) Basic knowledge of Word in the Office, which must be read. the following summary contains a summary.
Http://msdn.microsoft.com/en-us/library/Aa201330
Http://blog.csdn.net/hustliangchen/archive/2011/01/05/6118459.aspx:
(2) Structure of the Word class, including Application, document, Range, and Selection, which must be read
Http://msdn.microsoft.com/en-us/library/aa164012
(3) word 2007 object model:
Http://msdn.microsoft.com/en-us/library/bb244515 (v = office.12). aspx
(4) Microsoft. Office. Interop. Word
Http://msdn.microsoft.com/zh-cn/library/ms254954 (v = Office.11). aspx
(5) WPS secondary development interface documentation wpsapi. chm
Easy to read Chinese and download CSDN
(6) moth Word VBA reference tutorial
All Chinese word class libraries, must read
Http://www.feiesoft.com/vba/word/
(7) using VBA Macros to improve Word operation efficiency-20 classic instances that require excellent research
Http://pcmag.hexun.com/2010-03-18/123031946.html
3. Summary
(1) Document represents a specific word Document. Documents are a collection of Documents and are represented by an index. The ActiveDocument attribute is the document of the current focus. We generally do not use indexes to reference documents, because the index value changes as the document is opened or closed. Usually we use the ActiveDocument attribute, or the document object variable returned by the Add or Open method of the Documents set is referenced. Add or Open document will become ActiveDocument. To make other documents activeDocument, use the ActiveDocument method of the document Object.
Specify the specific ingress net with the file name,Documents("Report.doc").Activate();
(2) characters form words, words form sentences, and sentences form paragraphs. Therefore, a document contains four collections: Characters Words, Sentences, and Paragraphs collection. In addition, the document may contain a set of sections, and a section contains a set of HeadersFooters headers and footers.
(3) A Paragraph consists of a Paragraph sign and all texts. When a paragraph is copied, if the paragraph logo is included, the paragraph format is also copied. If you do not want to copy the paragraph logo, do not copy the paragraph logo.
(3) The Range object represents a continuous area defined by the START character and end character. It can be as small as one insert cursor or as large as the entire document content, it can also be but not necessarily the region represented by the current selection. Multiple Range objects can be defined in a document.
We usually use the Range class to define a variable to create a Range object, and then use the Range method of Document or the Range attribute of other objects to instantiate this Range object.
(4) Selection object
Can represent the cursor
This object represents the currently selected content in the window or pane. The selected content indicates the selected (or highlighted) area in the document. If no selected content exists in the document, it indicates the insertion point. Each document pane can have only one active Selection object and only one active Selection object in the application.
Use Selection object
You can use the Selection attribute to return the Selection object. If no object identifier is used for the Selection attribute, Word returns the selected content from the activity pane in the activity document window.
The Text attribute is the selected content.
Copy, Cut, and Paste operations
(5) sections
Sections. Add Method
This method is used to return a Section object, which indicates the new Section added to the document.
Function Add ([Range As Range = 0], [Start As WpsSectionStart = 2]) As Section
Parameter description
Range Variant type. Optional. The area before which the Delimiter is inserted. If this parameter is ignored, the Delimiter is inserted at the end of the document.
Start Variant type. Optional. The delimiter type to add. WpsSectionStart type. If this parameter is ignored, a "next page" type is added.
The WpsSectionStart type can be one of the following constants:
Value description
WpsSectionContinuous continuous delimiter
WpsSectionEvenPage even number of page Splitters
End of wpsSectionNewColumn
WpsSectionNewPage next page delimiter (default)
WpsSectionOddPage
Sections refer to MSDN
Section refer to MSDN
4. Specific Use
(1) how to set the title style, refer to "Title 1" and "title 2"
[C-sharp]View plaincopyprint?
/// Add a common section // public void AddParagraph (string s) {Word. paragraph p; p = oDoc. content. paragraphs. add (ref missing); p. range. text = s; object style = Word. wdBuiltinStyle. wdStyleBodyText; p. set_Style (ref style); p. range. insertParagraphAfter ();}
(2) how to insert a table
Using the Table class of Word, some people also use the DataTable class for assistance
(3) how to insert Images
InlineShapes is an Embedded Graph resource in Word.
[C-sharp]View plaincopyprint?
? Why does the image disappear after it is inserted?
This may be because you have inserted an image, but you have not moved the cursor, so the image is overwritten.
Solution: move the cursor
(4) move the cursor
A: Tag:
System pre-defined Tag: object oEndOfDoc = "// endofdoc ";
Custom Tag:
B: use tags to obtain the location
Word. Range wrdRng = oDoc. Bookmarks. get_Item (ref oEndOfDoc). Range;
This position is used when inserting paragraphs and tables:
OPara3 = oDoc. Content. Paragraphs. Add (ref oRng );
OTable = oDoc. Tables. Add (wrdRng, 3, 5, ref oMissing, ref oMissing );
[C-sharp]View plaincopyprint?
(5) generate a directory
[C-sharp]View plaincopyprint?
(6) how to set the directory format? For example, bold or skewed
Use paragraph format settings
[C-sharp]View plaincopyprint?
You have office, programming, and other software.
See yun.baidu.com/...type1_0.
Some of them haven't been uploaded yet. If you need anything, please tell me that maybe I will have
I want to be familiar with the basics of Excel Access operations, such as VB C language or
VBA is a built-in programming language in OFFICE. It is essential for many advanced applications, but it does not affect basic operations at all. Therefore, if you want to master EXCEL and ACCESS, we recommend that you step by step:
1. Familiar with basic software operations and module division, such as setting simple formulas in Excel, creating and querying Access, etc.
2. Be familiar with common internal formulas. The formulas are important in Excel and Access. You can help you to repeat all the formulas first and then focus on them.
3. to learn VBA and SQL, VBA is a simplified version of VB. If you have learned VB6, you can check it; the SQL language is the basis for understanding Access, and there are several types of basic statements.
All in all, as long as you really want to learn these two types of software, pay attention to the order of the three steps, and stick to the two months later, there will be a small success. As for Dacheng, it depends on the spirit of the individual. After all, there are hundreds of tools to use. It depends on whether you can combine tools with reality.