com.acesoft.aceoffix.wordwriter
Class DataRegion

java.lang.Object
  extended by com.acesoft.aceoffix.wordwriter.DataRegion

public class DataRegion
extends java.lang.Object

DataRegion class represents a DataRegion.

Representing a DataRegion, DataRegion class is used to fill data into DataRegion and control behavior of DataRegion. You can only call the WordDocument.openDataRegion method or the WordDocument.createDataRegion method to get the DataRegion object.

What is the DataRegion? In Word document, developer can define any range of selection as a DataRegion object by inserting a bookmark with the prefix name "ACE_". In other words, the DataRegion is a bookmark object whose name begins with "ACE_" in Word document. DataRegion is an important object of Aceoffix. And in many cases, you need to call it to perform your operations in Word document.

The bookmark name of a DataRegion is "ACE_" + DataRegionName. For example, if you want to define a specified range as a DataRegion whose DataRegionName is "ProductName" in a Word document, you should manually insert a bookmark whose name is "ACE_ProductName" for the range before you OpenDocument this document. Write code doc.openDataRegion("ProductName").setValue("Aceoffix"); you can generate what you want in this DataRegion.

Version:
5.0
Author:
Acesoft Corporation

Method Summary
 Table createTable(int numRows, int numColumns, WdAutoFitBehavior autoFitBehavior)
          Creates a new Table in the current DataRegion.
 boolean getEditing()
          Gets a value that indicates whether the DataRegion is editable.
 Font getFont()
          Gets the font object.
 java.lang.String getName()
          Gets the name of the DataRegion.
 ParagraphFormat getParagraphFormat()
          Gets the ParagraphFormat object.
 Shading getShading()
          Gets the Shading object.
 boolean getSubmitAsFile()
          Gets a value that indicates whether the DataRegion is submitted as a Word file when saving.
 Table openTable(int index)
          Opens the specified table.
 void selectEnd()
          Moves the cursor to the end of the current DataRegion.
 void selectStart()
          Moves the cursor to the start of the current DataRegion.
 void setEditing(boolean value)
          Sets a value that indicates whether the DataRegion is editable.
 void setSubmitAsFile(boolean value)
          Sets a value that indicates whether the DataRegion is submitted as a Word file when saving.
 void setValue(java.lang.String value)
          Sets the value of the DataRegion.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
                         throws java.io.IOException
Gets the name of the DataRegion.

Throws:
java.io.IOException

getEditing

public boolean getEditing()
Gets a value that indicates whether the DataRegion is editable.


setEditing

public void setEditing(boolean value)
Sets a value that indicates whether the DataRegion is editable.

After opening the Word document in Aceoffix.OpenModeType.docSubmitForm mode, only the DataRegions with Editing=true are editable. Besides those editable DataRegions, the document is read-only.

This function is used to control the editable regions in Word document or to make Word document as an input Form for users.

See Also:
WordDocument.openDataRegion() to learn how to make the DataRegion editable.

getSubmitAsFile

public boolean getSubmitAsFile()
Gets a value that indicates whether the DataRegion is submitted as a Word file when saving.


setSubmitAsFile

public void setSubmitAsFile(boolean value)
Sets a value that indicates whether the DataRegion is submitted as a Word file when saving.

After opening Word document in Aceoffix.OpenModeType.docSubmitForm mode, if SubmitAsFile=true, the Word fragment contained in the current DataRegion can be got when saving. This fragment is a binary stream file in Word format and can be saved as a separate word file.


setValue

public void setValue(java.lang.String value)
              throws java.lang.Exception,
                     java.io.IOException
Sets the value of the DataRegion.

Throws:
java.lang.Exception
java.io.IOException
See Also:
WordDocument.openDataRegion() to learn how to set the value of the DataRegion.

getFont

public Font getFont()
Gets the font object.

Returns:
The font object defined in Microsoft Word.

getParagraphFormat

public ParagraphFormat getParagraphFormat()
Gets the ParagraphFormat object.

Returns:
The ParagraphFormat object defined in Microsoft Word.

getShading

public Shading getShading()
Gets the Shading object.

Returns:
The Shading object defined in Microsoft Word.

openTable

public Table openTable(int index)
                throws java.lang.Exception
Opens the specified table.

Parameters:
index - The index of the Table. It is the same as the Table index defined in Microsoft Word. Both of them start from "1".
Returns:
Returns a Table object.
Throws:
java.lang.Exception

createTable

public Table createTable(int numRows,
                         int numColumns,
                         WdAutoFitBehavior autoFitBehavior)
                  throws java.lang.Exception
Creates a new Table in the current DataRegion.

Parameters:
numRows - The row number of the new table.
numColumns - The column number of the new table.
autoFitBehavior - It is used to automatically resize the table in Microsoft Word.
Returns:
Returns the new Table object.
Throws:
java.lang.Exception

selectStart

public void selectStart()
Moves the cursor to the start of the current DataRegion.


selectEnd

public void selectEnd()
Moves the cursor to the end of the current DataRegion.