In the normal work, the way to generate word is mainly C # read HTML template file after processing saved as. doc file, such benefits are convenient, fast, can meet most of the needs. However, some special needs are not satisfied, such as to generate word for a table, but only a part of the string needs to change, using the method above to generate a
People who have used pageoffice to dynamically generate Word documents know that Pageoffice can populate a Word document at a specified location, where we say that there are two concepts in the Pageoffice terminology. One is called the data region (DataRegion) and the other is the data label (DATATAG).First, the conceptData range: A document area that is located
1, create a new Word template by looking for a Word document that needs to be populated with a program, and saving it if you want to enter it with a bookmark (insert--> bookmark--> enter Id-->ok).2, modify the security add everyone readable on the word template to prevent th
C # process automatic report generation by Word. 3. design template,
Since it is a template, various tags and configurations are indispensable. The word bookmarks are mainly used here.
Press ctrl + shift + F5 to open the word bookmarks Function
For example
As shown in, you
(ex.message);
}
}
public void Filllable (String labelid,string Content)
{
Open Word Template
Opentempelte (Tempname); Fill in the contents of the Labelid label, that is, the subject item of the letter
Object BKMC = Labelid;
if (WordApp.ActiveDocument.Bookmarks.Exists (labelid) = = True)
{
WordApp.ActiveDocument.Bookmarks.get_Item (ref BKMC). Select ();
)
{
Open Word Template
Opentempelte (Tempname); Fill in the contents of the Labelid label, that is, the subject item of the letter
Object BKMC = Labelid;
if (WordApp.ActiveDocument.Bookmarks.Exists (labelid) = = True)
{
WordApp.ActiveDocument.Bookmarks.get_Item (ref BKMC). Select ();
}
WordApp.Selection.TypeText (Content);
SaveAs (Saveasfilename);
Quit ();
}
}
1, open Word2010, directly pop-up the following dialog box, the hint can not find the template.
2, click the file--New button, find the option.
3, in the Add-in label, click Go to the button, jump to the Add-in interface, find the "PowerDesigner" related to the item, remove the previous tick, click "OK" button. Restart the Word2010, you can.
4, if still unable to resolve, then can only modify the r
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.