Click or drag to resize
WordDocumentCreateDataRegion Method
Creates a new DataRegion and returns a DataRegion object.

Namespace: Aceoffix.WordWriter
Assembly: Aceoffix (in Aceoffix.dll) Version: 5.0.0.1
Syntax
public DataRegion CreateDataRegion(
	string NewDataRegionName,
	DataRegionInsertType InsertType,
	string RelativeDataRegionName
)

Parameters

NewDataRegionName
Type: SystemString
The name of new DataRegion. Note: The name should be different from that of the existing DataRegions in the document.
InsertType
Type: Aceoffix.WordWriterDataRegionInsertType
The insert type of the new DataRegion.
RelativeDataRegionName
Type: SystemString
The name of the relative DataRegion.

Return Value

Type: DataRegion
Returns the DataRegion object.
Remarks

Creates a new DataRegion and returns DataRegion object. It's easy to call this method to create, assign and control a new DataRegion before or after the specified DataRegion.

Typically, the RelativeDataRegionName is the existing DataRegion predefined by user in document. In addition, it can also be other two special DataRegions: [HOME] and [END] that are reserved by Aceoffix. Respectively representing the cursor positions of start and end in document, [HOME] and [END] do not need to be defined manually by user.

If the current document is a blank document without any DataRegion, you can use [HOME] and [END] to generate a formatted document with text and images in a blank document.

Examples

The following example shows how to call the CreateDataRegion method to create new DataRegion and populate the new DataRegion with the data. The new DataRegion "NewProductName" is located before the DataRegion "ProductName".

Before running the code, please make sure that you have inserted the bookmark "ACE_CompanyName" and the bookmark "ACE_ProductName" into the test.doc.

Aceoffix.WordWriter.WordDocument wd = new Aceoffix.WordWriter.WordDocument();

wd.OpenDataRegion("CompanyName").Value = "Acesoft";
wd.OpenDataRegion("ProductName").Value = "Aceoffix";
Aceoffix.WordWriter.DataRegion drNewProduct = wd.CreateDataRegion("NewProductName", Aceoffix.WordWriter.DataRegionInsertType.Before, "ProductName");
drNewProduct.Value = "Aceoffix for Android";

AceoffixCtrl1.ServerPage = "aceoffix-runtime/server.aspx";
AceoffixCtrl1.Bind(wd);
AceoffixCtrl1.OpenDocument("doc/test.doc", Aceoffix.OpenModeType.docReadOnly, "Tom"); //Open document with read-only.
See Also