Help Center
Help Center›AfxNova›Windows

CTextPara2 Class

Members (69)

AddTabAdds a tab at the displacement *tbPos*, with type *tbAlign*, and leader style, *tbLeader*.CanChangeDetermines whether the paragraph formatting can be changed.ClearAllTabsClears all tabs, reverting to equally spaced tabs with the default tab spacing.CONSTRUCTORCalled when a class variable is created.DeleteTabDeletes a tab at a specified displacement.DESTRUCTORCalled automatically when a class variable goes out of scope or is destroyed.GetAlignmentRetrieves the current paragraph alignment value.GetBordersNot implemented. Gets the borders collection.GetDuplicateGets a duplicate of this text paragraph format object.GetDuplicate2Gets a duplicate of this text paragraph format object.GetEffectsGets the paragraph format effects.GetErrorInfoReturns a description of the last result code.GetFirstLineIndentRetrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for all lines of the paragraph except the first line.GetFontAlignmentGets the paragraph font alignment state.GetHangingPunctuationGets whether to hang punctuation symbols on the right margin when the paragraph is justified.GetHyphenationDetermines whether automatic hyphenation is enabled for the range.GetKeepTogetherDetermines whether page breaks are allowed within paragraphs.GetKeepWithNextDetermines whether page breaks are allowed between paragraphs in the range.GetLastResultReturns the last result codeGetLeftIndentRetrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin.GetLineSpacingRetrieves the line-spacing value for the text range.GetLineSpacingRuleRetrieves the line-spacing rule for the text range.GetListAlignmentRetrieves the kind of alignment to use for bulleted and numbered lists.GetListLevelIndexRetrieves the list level index used with paragraphs.GetListStartRetrieves the starting value or code of a list numbering sequence.GetListTabRetrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered or bulleted text is left-justified, centered, or right-justified at the first-line indent value.GetListTypeRetrieves the kind of numbering to use with paragraphs.GetNoLineNumberDetermines whether paragraph numbering is enabled.GetPageBreakBeforeDetermines whether each paragraph in the range must begin on a new page.GetPropertyGets the value of the specified property.GetRightIndentRetrieves the size of the right margin indent of a paragraph.GetSnapToGridGets whether paragraph lines snap to a vertical grid that could be defined for the whole document.GetSpaceAfterThe space-after value, in floating-point points.GetSpaceBeforeRetrieves the amount of vertical space above a paragraph.GetStyleRetrieves the style handle to the paragraphs in the specified range.GetTabRetrieves tab parameters (displacement, alignment, and leader style) for a specified tab.GetTabCountRetrieves the tab count.GetTrimPunctuationAtStartGets whether to trim the leading space of a punctuation symbol at the start of a line.GetWidowControlRetrieves the widow and orphan control state for the paragraphs in a range.IsEqualDetermines if the current range has the same properties as a specified range.IsEqual2Determines if the current range has the same properties as a specified range.ResetResets the paragraph formatting to a choice of default values.SetAlignmentSets the paragraph alignment.SetDuplicateSets the formatting for an existing paragraph by copying a given format.SetDuplicate2Sets the formatting for an existing paragraph by copying a given format.SetEffectsSets the paragraph format effects.SetFontAlignmentSets the paragraph font alignment for Chinese, Japanese, Korean text.SetHangingPunctuationSets whether to hang punctuation symbols on the right margin when the paragraph is justified.SetHyphenationControls hyphenation for the paragraphs in the range.SetIndentsSets the first-line indent, the left indent, and the right indent for a paragraph.SetKeepTogetherControls whether page breaks are allowed within a paragraph in a range.SetKeepWithNextControls whether page breaks are allowed between the paragraphs in a range.SetLineSpacingSets the paragraph line-spacing rule and the line spacing for a paragraph.SetListAlignmentSets the alignment of bulleted or numbered text used for paragraphs.SetListLevelIndexSets the list level index used for paragraphs.SetListStartSets the starting number or Unicode value for a numbered list.SetListTabSets the list tab setting, which is the distance between the first indent and the start of the text on the first line.SetListTypeSets the type of list to be used for paragraphs.SetNoLineNumberDetermines whether to suppress line numbering of paragraphs in a range.SetPageBreakBeforeControls whether there is a page break before each paragraph in a range.SetPropertySets the property value.SetResultSets the last result code.SetRightIndentSets the right margin of paragraph.SetSnapToGridSets whether paragraph lines snap to a vertical grid that could be defined for the whole document.SetSpaceAfterSets the amount of space that follows a paragraph.SetSpaceBeforeSets the amount of space preceding a paragraph.SetStyleSets the paragraph style for the paragraphs in a range.SetTrimPunctuationAtStartSets whether to trim the leading space of a punctuation symbol at the start of a line.SetWidowControlControls the suppression of widows and orphans.

Documentation

CTextPara2 Class

Class that wraps all the methods of the ITextPara and ITextPara2 interfaces.

NameDescription
CONSTRUCTORCalled when a class variable is created.
DESTRUCTORCalled automatically when a class variable goes out of scope or is destroyed.

ITextPara Interface

Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.

The ITextPara interface inherits from the IDispatch interface. ITextPara also has these types of members:

NameDescription
GetDuplicateGets a duplicate of this text paragraph format object.
SetDuplicateSets the formatting for an existing paragraph by copying a given format.
CanChangeDetermines whether the paragraph formatting can be changed.
IsEqualDetermines if the current range has the same properties as a specified range.
ResetResets the paragraph formatting to a choice of default values.
GetStyleRetrieves the style handle to the paragraphs in the specified range.
SetStyleSets the paragraph style for the paragraphs in a range.
GetAlignmentRetrieves the current paragraph alignment value.
SetAlignmentSets the paragraph alignment.
GetHyphenationDetermines whether automatic hyphenation is enabled for the range.
SetHyphenationControls hyphenation for the paragraphs in the range.
GetFirstLineIndentRetrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for all lines of the paragraph except the first line.
GetKeepTogetherDetermines whether page breaks are allowed within paragraphs.
SetKeepTogetherControls whether page breaks are allowed within a paragraph in a range.
GetKeepWithNextDetermines whether page breaks are allowed between paragraphs in the range.
SetKeepWithNextControls whether page breaks are allowed between the paragraphs in a range.
GetLeftIndentRetrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin.
GetLineSpacingRetrieves the line-spacing value for the text range.
GetLineSpacingRuleRetrieves the line-spacing rule for the text range.
GetListAlignmentRetrieves the kind of alignment to use for bulleted and numbered lists.
SetListAlignmentSets the alignment of bulleted or numbered text used for paragraphs.
GetListLevelIndexRetrieves the list level index used with paragraphs.
SetListLevelIndexSets the list level index used for paragraphs.
GetListStartRetrieves the starting value or code of a list numbering sequence.
SetListStartSets the starting number or Unicode value for a numbered list.
GetListTabRetrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered or bulleted text is left-justified, centered, or right-justified at the first-line indent value.
SetListTabSets the list tab setting, which is the distance between the first indent and the start of the text on the first line.
GetListTypeRetrieves the kind of numbering to use with paragraphs.
SetListTypeSets the type of list to be used for paragraphs.
GetNoLineNumberDetermines whether paragraph numbering is enabled.
SetNoLineNumberDetermines whether to suppress line numbering of paragraphs in a range.
GetPageBreakBeforeDetermines whether each paragraph in the range must begin on a new page.
SetPageBreakBeforeControls whether there is a page break before each paragraph in a range.
GetRightIndentRetrieves the size of the right margin indent of a paragraph.
SetRightIndentSets the right margin of paragraph.
SetIndentsSets the first-line indent, the left indent, and the right indent for a paragraph.
SetLineSpacingSets the paragraph line-spacing rule and the line spacing for a paragraph.
GetSpaceAfterThe space-after value, in floating-point points.
SetSpaceAfterSets the amount of space that follows a paragraph.
GetSpaceBeforeRetrieves the amount of vertical space above a paragraph.
SetSpaceBeforeSets the amount of space preceding a paragraph.
GetWidowControlRetrieves the widow and orphan control state for the paragraphs in a range.
SetWidowControlControls the suppression of widows and orphans.
GetTabCountRetrieves the tab count.
AddTabAdds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader.
ClearAllTabsClears all tabs, reverting to equally spaced tabs with the default tab spacing.
DeleteTabDeletes a tab at a specified displacement.
GetTabRetrieves tab parameters (displacement, alignment, and leader style) for a specified tab.

ITextPara2 Interface

The ITextPara2 interface extends ITextPara, providing the equivalent of the Microsoft Word format-paragraph dialog.

The ITextPara2 interface has these methods.

NameDescription
GetBordersNot implemented. Gets the borders collection.
GetDuplicate2Gets a duplicate of this text paragraph format object.
SetDuplicate2Sets the formatting for an existing paragraph by copying a given format.
GetFontAlignmentGets the paragraph font alignment state.
SetFontAlignmentSets the paragraph font alignment for Chinese, Japanese, Korean text.
GetHangingPunctuationGets whether to hang punctuation symbols on the right margin when the paragraph is justified.
SetHangingPunctuationSets whether to hang punctuation symbols on the right margin when the paragraph is justified.
GetSnapToGridGets whether paragraph lines snap to a vertical grid that could be defined for the whole document.
SetSnapToGridSets whether paragraph lines snap to a vertical grid that could be defined for the whole document.
GetTrimPunctuationAtStartGets whether to trim the leading space of a punctuation symbol at the start of a line.
SetTrimPunctuationAtStartSets whether to trim the leading space of a punctuation symbol at the start of a line.
GetEffectsGets the paragraph format effects.
GetPropertyGets the value of the specified property.
IsEqual2Determines if the current range has the same properties as a specified range.
SetEffectsSets the paragraph format effects.
SetPropertySets the property value.

Methods inherited from CTextObjectBase Class

NameDescription
GetLastResultReturns the last result code
SetResultSets the last result code.
GetErrorInfoReturns a description of the last result code.

CONSTRUCTOR

Called when a CTextPara2 class variable is created.

CONSTRUCTOR (BYVAL pTextPara2 AS ITextPara2 PTR, BYVAL fAddRef AS BOOLEAN = FALSE)
ParameterDescription
pTextPara2An ITextPara2 interface pointer.
fAddRefOptional. TRUE to increment the reference count of the passed ITextPara2 interface pointer; otherwise, FALSE. Default is FALSE.
Return value

A pointer to the new instance of the class.


DESTRUCTOR

Called automatically when a class variable goes out of scope or is destroyed.

DESTRUCTOR

GetLastResult

Returns the last result code

FUNCTION GetLastResult () AS HRESULT
   RETURN m_Result
END FUNCTION

SetResult

Sets the last result code.

FUNCTION SetResult (BYVAL Result AS HRESULT) AS HRESULT
ParameterDescription
ResultThe HRESULT error code returned by the methods.

GetErrorInfo

Returns a description of the last result code.

FUNCTION GetErrorInfo () AS DWSTRING

GetDuplicate

Gets a duplicate of this range object. In this implementation of the class, GetDuplicate and GetDuplicate2 are the same method.

FUNCTION GetDuplicate () AS ITextPara2 PTR
Return value

The duplicate of the range.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_OUTOFMEMORYMemory could not be allocated for the new object.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetDuplicate

Sets the properties of this object by copying the properties of another text paragraph object. In this implementation of the class, SetDuplicate and SetDuplicate2 are the same method.

FUNCTION SetDuplicate (BYVAL pPara AS ITextPara2 PTR) AS HRESULT
ParameterDescription
pParaThe text paragraph object to copy from.
Return value

If SetDuplicate2 succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Return codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.

CanChange

Determines whether the paragraph formatting can be changed.

FUNCTION CanChange (BYVAL pPara AS ITextPara2 PTR) AS LONG
Return value

tomTrue if the paragraph formatting can be changed or tomFalse if it cannot be changed.

Result code

If paragraph formatting can change, CanChange succeeds and GetLastResult returns S_OK. If paragraph formatting cannot change, the method fails and returns S_FALSE.


IsEqual

Determines if the current range has the same properties as a specified range. In this implementation of the class, IsEqual and IsEqual2 are the same method.

FUNCTION IsEqual (BYVAL pPara AS ITextPara2 PTR) AS LONG
ParameterDescription
pParaThe ITextPara2 range that is compared to the current range.
Return value

A tomBool value that is tomTrue if the text paragraph objects have the same properties, or tomFalse if they don't.

Result code

If paragraph formatting can change, IsEqual succeeds and GetLastResult returns S_OK. If paragraph formatting cannot change, the method fails and returns S_FALSE.


Reset

Determines whether the paragraph formatting can be changed.

FUNCTION Reset (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueType of reset. It can be one of the following possible values.
ValueMeaning
tomDefaultUsed for paragraph formatting that is defined by the RTF \pard, that is, the paragraph default control word.
tomUndefinedUsed for all undefined values. The tomUndefined value is only valid for duplicate (clone) ITextPara2 objects.
Return value

If Reset succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Return codeDescription
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetStyle

Retrieves the style handle to the paragraphs in the specified range.

FUNCTION GetStyle () AS LONG
Return value

The paragraph style handle.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

Remarks The Text Object Model (TOM) version 1.0 has no way to specify the meanings of user-defined style handles. They depend on other facilities of the text system implementing TOM. Negative style handles are reserved for built-in character and paragraph styles. Currently defined values are listed in the following table. For a description of the following styles, see the Microsoft Word documentation.

StyleValueStyleValue
StyleNormal-1StyleTableofAuthorities-45
StyleHeading1-2StyleMacroText-46
StyleHeading2-3StyleTOAHeading-47
StyleHeading3-4StyleList-48
StyleHeading4-5StyleListBullet-49
StyleHeading5-6StyleListNumber-50
StyleHeading6-7StyleList2-51
StyleHeading7-8StyleList3-52
StyleHeading8-9StyleList4-53
StyleHeading9-10StyleList5-54
StyleIndex1-11StyleListBullet2-55
StyleIndex2-12StyleListBullet3-56
StyleIndex3-13StyleListBullet4-57
StyleIndex4-14StyleListBullet5-58
StyleIndex5-15StyleListNumber2-59
StyleIndex6-16StyleListNumber3-60
StyleIndex7-17StyleListNumber4-61
StyleIndex8-18StyleListNumber5-62
StyleIndex9-19StyleTitle-63
StyleTOC1-20StyleClosing-64
StyleTOC2-21StyleClosing-65
StyleTOC3-22StyleDefaultParagraphFont-66
StyleTOC4-23StyleBodyText-67
StyleTOC5-24StyleBodyTextIndent-68
StyleTOC6-25StyleListContinue-69
StyleTOC7-26StyleListContinue2-70
StyleTOC8-27StyleListContinue3-71
StyleTOC9-28StyleListContinue4-72
StyleNormalIndent-29StyleListContinue5-73
StyleFootnoteText-30StyleMessageHeader-74
StyleAnnotationText-31StyleSubtitle-75
StyleHeader-32StyleSalutation-76
StyleFooter-33StyleDate-77
StyleIndexHeading-34StyleBodyTextFirstIndent-78
StyleCaption-35StyleBodyTextFirstIndent2-79
StyleTableofFigures-36StyleNoteHeading-80
StyleEnvelopeAddress-37StyleBodyText2-81
StyleEnvelopeReturn-38StyleBodyText3-82
StyleFootnoteReference-39StyleBodyTextIndent2-83
StyleAnnotationReference-40StyleBodyTextIndent3-84
StyleLineNumber-41StyleBlockQuotation-85
StylePageNumber-42StyleHyperlink-86
StyleEndnoteReference-43StyleHyperlinkFollowed-87
StyleEndnoteText-44

SetStyle

Sets the paragraph style for the paragraphs in a range.

FUNCTION SetStyle (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueNew paragraph style handle.
StyleValueStyleValue
StyleNormal-1StyleTableofAuthorities-45
StyleHeading1-2StyleMacroText-46
StyleHeading2-3StyleTOAHeading-47
StyleHeading3-4StyleList-48
StyleHeading4-5StyleListBullet-49
StyleHeading5-6StyleListNumber-50
StyleHeading6-7StyleList2-51
StyleHeading7-8StyleList3-52
StyleHeading8-9StyleList4-53
StyleHeading9-10StyleList5-54
StyleIndex1-11StyleListBullet2-55
StyleIndex2-12StyleListBullet3-56
StyleIndex3-13StyleListBullet4-57
StyleIndex4-14StyleListBullet5-58
StyleIndex5-15StyleListNumber2-59
StyleIndex6-16StyleListNumber3-60
StyleIndex7-17StyleListNumber4-61
StyleIndex8-18StyleListNumber5-62
StyleIndex9-19StyleTitle-63
StyleTOC1-20StyleClosing-64
StyleTOC2-21StyleClosing-65
StyleTOC3-22StyleDefaultParagraphFont-66
StyleTOC4-23StyleBodyText-67
StyleTOC5-24StyleBodyTextIndent-68
StyleTOC6-25StyleListContinue-69
StyleTOC7-26StyleListContinue2-70
StyleTOC8-27StyleListContinue3-71
StyleTOC9-28StyleListContinue4-72
StyleNormalIndent-29StyleListContinue5-73
StyleFootnoteText-30StyleMessageHeader-74
StyleAnnotationText-31StyleSubtitle-75
StyleHeader-32StyleSalutation-76
StyleFooter-33StyleDate-77
StyleIndexHeading-34StyleBodyTextFirstIndent-78
StyleCaption-35StyleBodyTextFirstIndent2-79
StyleTableofFigures-36StyleNoteHeading-80
StyleEnvelopeAddress-37StyleBodyText2-81
StyleEnvelopeReturn-38StyleBodyText3-82
StyleFootnoteReference-39StyleBodyTextIndent2-83
StyleAnnotationReference-40StyleBodyTextIndent3-84
StyleLineNumber-41StyleBlockQuotation-85
StylePageNumber-42StyleHyperlink-86
StyleEndnoteReference-43StyleHyperlinkFollowed-87
StyleEndnoteText-44
Return value

If SetStyle succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetAlignment

Retrieves the current paragraph alignment value.

FUNCTION GetAlignment () AS LONG
Return value

The paragraph alignment, which can be one of the following values.

ValueDescription
tomAlignLeftText aligns with the left margin.
tomAlignCenterText is centered between the margins.
tomAlignRightText aligns with the right margin.
tomAlignJustifyText starts at the left margin and, if the line extends beyond the right margin, all the spaces in the line are adjusted to be even.
tomAlignInterWordSame as tomAlignJustify.
tomAlignNewspaperSame as tomAlignInterLetter, but uses East Asian metrics.
tomAlignInterLetterThe first and last characters of each line (except the last line) are aligned to the left and right margins, and lines are filled by adding or subtracting the same amount from each character.
tomAlignScaledSame as tomAlignInterLetter, but uses East Asian metrics, and scales the spacing by the width of characters.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetAlignment

Sets the paragraph alignment.

FUNCTION SetAlignment (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueNew paragraph alignment.
ValueDescription
tomAlignLeftText aligns with the left margin.
tomAlignCenterText is centered between the margins.
tomAlignRightText aligns with the right margin.
tomAlignJustifyText starts at the left margin and, if the line extends beyond the right margin, all the spaces in the line are adjusted to be even.
tomAlignInterWordSame as tomAlignJustify.
tomAlignNewspaperSame as tomAlignInterLetter, but uses East Asian metrics.
tomAlignInterLetterThe first and last characters of each line (except the last line) are aligned to the left and right margins, and lines are filled by adding or subtracting the same amount from each character.
tomAlignScaledSame as tomAlignInterLetter, but uses East Asian metrics, and scales the spacing by the width of characters.
Return value

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetHyphenation

Determines whether automatic hyphenation is enabled for the range.

FUNCTION GetHyphenation () AS LONG
Return value

One of the following values:

ValueDescription
tomTrueAutomatic hyphenation is enabled.
tomFalseAutomatic hyphenation is disabled.
tomUndefinedThe hyphenation property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

This property corresponds to the PFE_DONOTHYPHEN effect described in the PARAFORMAT2 structure.


SetHyphenation

Controls hyphenation for the paragraphs in the range.

FUNCTION SetHyphenation (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueIndicates how hyphenation is controlled. It can be one of the following possible values.
ValueDescription
tomTrueAutomatic hyphenation is enabled.
tomFalseAutomatic hyphenation is disabled.
tomUndefinedThe hyphenation property is undefined.
Return value

If SetHyphenation succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetFirstLineIndent

Retrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for all lines of the paragraph except the first line.

FUNCTION GetFirstLineIndent () AS SINGLE
Return value

The first-line indentation amount in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

To set the first line indentation amount, call the SetIndents method.

To get and set the indent for all other lines of the paragraph (that is, the left indent), use GetLeftIndent and SetIndents.


GetKeepTogether

Determines whether page breaks are allowed within paragraphs.

FUNCTION GetKeepTogether () AS LONG
Return value

One of the following values.

ValueDescription
tomTruePage breaks are not allowed within a paragraph.
tomFalsePage breaks are allowed within a paragraph.
tomUndefinedThe property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure.


SetKeepTogether

Controls whether page breaks are allowed within a paragraph in a range.

FUNCTION SetKeepTogether (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueIndicates whether page breaks are allowed within a paragraph in a range. It can be one of the following possible values.
ValueDescription
tomTruePage breaks are not allowed within a paragraph.
tomFalsePage breaks are allowed within a paragraph.
tomUndefinedThe property is undefined.
Return value

If SetKeepTogether succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetKeepWithNext

Determines whether page breaks are allowed between paragraphs in the range.

FUNCTION GetKeepWithNext () AS LONG
Return value

One of the following values.

ValueDescription
tomTruePage breaks are not allowed between paragraphs.
tomFalsePage breaks are allowed between paragraphs.
tomUndefinedThe property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.


SetKeepWithNext

Controls whether page breaks are allowed between the paragraphs in a range.

FUNCTION SetKeepWithNext (BYVAL Value AS LONG) AS HRESULT
   this.SetResult(m_pTextPara2->lpvtbl->SetKeepWithNext(m_pTextPara2, Value))
   RETURN m_Result
END FUNCTION
ParameterDescription
ValueIndicates if page breaks can be used between the paragraphs of a range. It can be one of the following possible values.
tomTruePage breaks are not allowed between paragraphs.
tomFalsePage breaks are allowed between paragraphs.
tomUndefinedThe property is undefined.
Return value

If SetKeepWithNext succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.


GetLeftIndent

Retrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin.

FUNCTION GetLeftIndent () AS SINGLE
Return value

The left indentation, in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetLineSpacing

Retrieves the line-spacing value for the text range.

FUNCTION GetLineSpacing () AS SINGLE
Return value

The line-spacing value. The following table shows how this value is interpreted for the different line-spacing rules.

Line spacing ruleMeaning
tomLineSpaceSingleSingle spacing. The line-spacing value is ignored.
tomLineSpace1pt5One-and-a-half line spacing. The line-spacing value is ignored.
tomLineSpaceDoubleDouble line spacing. The line-spacing value is ignored.
tomLineSpaceAtLeastThe line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less than single spacing, the control displays single-spaced text.
tomLineSpaceExactlyThe line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is less than single spacing).
tomLineSpaceMultipleThe line-spacing value specifies the line spacing, in lines.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetLineSpacingRule

Retrieves the line-spacing rule for the text range.

FUNCTION GetLineSpacingRule () AS LONG
Return value

One of the following values that indicates the line-spacing rule.

Line spacing ruleMeaning
tomLineSpaceSingleSingle space. The line-spacing value is ignored.
tomLineSpace1pt5One-and-a-half line spacing. The line-spacing value is ignored.
tomLineSpaceDoubleDouble line spacing. The line-spacing value is ignored.
tomLineSpaceAtLeastThe line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less than single spacing, the control displays single-spaced text.
tomLineSpaceExactlyThe line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is less than single spacing).
tomLineSpaceMultipleThe line-spacing value specifies the line spacing, in lines.
tomLineSpacePercentThe line-spacing value specifies the line spacing by percent of line height.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetListAlignment

Retrieves the kind of alignment to use for bulleted and numbered lists.

FUNCTION GetListAlignment () AS LONG
Return value

One of the following values that indicates the kind of bullet and numbering alignment.

Line spacing ruleMeaning
tomAlignLeftText is left aligned.
tomAlignCenterText is centered in the line.
tomAlignRightText is right aligned.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetListAlignment

Sets the alignment of bulleted or numbered text used for paragraphs.

FUNCTION SetListAlignment (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueNew list alignment value.
Line spacing ruleMeaning
tomAlignLeftText is left aligned.
tomAlignCenterText is centered in the line.
tomAlignRightText is right aligned.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetListLevelIndex

Retrieves the list level index used with paragraphs.

FUNCTION GetListLevelIndex () AS LONG
Return value

The list level index.

ValueMeaning
0No list.
1First-level (outermost) list.
2Second-level (nested) list. This is nested under a level 1 list item.
3Third-level (nested) list. This is nested under a level 2 list item.
and so forthNesting continues similarly.

Up to three levels are common in HTML documents.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetListLevelIndex

Sets the list level index used for paragraphs.

FUNCTION SetListLevelIndex (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueThe new list level index value.
ValueMeaning
0No list.
1First-level (outermost) list.
2Second-level (nested) list. This is nested under a level 1 list item.
3Third-level (nested) list. This is nested under a level 2 list item.
and so forthNesting continues similarly.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetListStart

Retrieves the starting value or code of a list numbering sequence.

FUNCTION GetListStart () AS LONG
Return value

The starting value or code of a list numbering sequence.

ValueMeaning
tomListNoneNot a list paragraph.
tomListBulletList uses bullets (&h2022); other bullets are given by > 32.
tomListNumberAsArabicList is numbered with Arabic numerals (0, 1, 2, ...).
tomListNumberAsLCLetterList is ordered with lowercase letters (a, b, c, ...).
tomListNumberAsUCLetterList is ordered with uppercase Arabic letters (A, B, C, ...).
tomListNumberAsLCRomanList is ordered with lowercase Roman letters (i, ii, iii, ...).
tomListNumberAsUCRomanList is ordered with uppercase Roman letters (I, II, III, ...).
tomListNumberAsSequenceThe value returned by GetListStart is treated as the first code in a Unicode sequence.
tomListNumberedCircleList is ordered with Unicode circled numbers.
tomListNumberedBlackCircleWingdingList is ordered with Wingdings black circled digits.
tomListNumberedArabicWideFull-width ASCII (0, 1, 2, 3, …).
tomListNumberedChSChinese with 十 only in items 10 through 99. (一, 二, 三, 四…).
tomListNumberedChTChinese with 十 only in items 10 through 19.
tomListNumberedJpnChsChinese with a full-width period, no 十.
tomListNumberedJpnKorChinese with no 十.
tomListNumberedArabic1Arabic alphabetic ( أ ,ب ,ت ,ث ,…).
tomListNumberedArabic2Arabic abjadi ( أ ,ب ,ج ,د ,…).
tomListNumberedHebrewHebrew alphabet (א, ב, ג, ד, …).
tomListNumberedThaiAlphaThai alphabetic (ก, ข,ค, ง, …).
tomListNumberedThaiNumThai numbers (๑, ๒,๓, ๔…).
tomListNumberedHindiAlphaHindi vowels (अ, आ, इ, ई, …).
tomListNumberedHindiAlpha1Hindi consonants (क, ख, ग, घ, …).
tomListNumberedHindiNumHindi numbers (१, २, ३, ४, …).

By default, numbers are followed by a right parenthesis, for example: 1). However, the returnes value can include one of the following flags to indicate a different formatting.

ValueMeaning
tomListMinusFollows the number with a hyphen (-).
tomListParenthesesEncloses the number in parentheses, as in: (1).
tomListPeriodFollows the number with a period.
tomListPlainUses the number alone.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

For a discussion on which sequence to use, see the GetListType method.


SetListStart

Sets the starting number or Unicode value for a numbered list.

FUNCTION SetListStart (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueNew starting number or Unicode value for a numbered list.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

Other characteristics of a list are specified by SetListType.


GetListTab

Retrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered or bulleted text is left-justified, centered, or right-justified at the first-line indent value.

FUNCTION GetListTab () AS SINGLE
Return value

The list tab setting. The list tab value is in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetListTab

Sets the list tab setting, which is the distance between the first indent and the start of the text on the first line.

FUNCTION SetListTab (BYVAL Value AS SINGLE) AS HRESULT
ParameterDescription
ValueNew list tab value, in floating-point points.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetListType

Retrieves the kind of numbering to use with paragraphs.

FUNCTION GetListType () AS LONG
Return value

One of the following values to indicate the kind of list numbering.

ValueMeaning
tomListNoneNot a list paragraph.
tomListBulletList uses bullets (&h2022); other bullets are given by > 32.
tomListNumberAsArabicList is numbered with Arabic numerals (0, 1, 2, ...).
tomListNumberAsLCLetterList is ordered with lowercase letters (a, b, c, ...).
tomListNumberAsUCLetterList is ordered with uppercase Arabic letters (A, B, C, ...).
tomListNumberAsLCRomanList is ordered with lowercase Roman letters (i, ii, iii, ...).
tomListNumberAsUCRomanList is ordered with uppercase Roman letters (I, II, III, ...).
tomListNumberAsSequenceThe value returned by GetListStart is treated as the first code in a Unicode sequence.
tomListNumberedCircleList is ordered with Unicode circled numbers.
tomListNumberedBlackCircleWingdingList is ordered with Wingdings black circled digits.
tomListNumberedArabicWideFull-width ASCII (0, 1, 2, 3, …).
tomListNumberedChSChinese with 十 only in items 10 through 99. (一, 二, 三, 四…).
tomListNumberedChTChinese with 十 only in items 10 through 19.
tomListNumberedJpnChsChinese with a full-width period, no 十.
tomListNumberedJpnKorChinese with no 十.
tomListNumberedArabic1Arabic alphabetic ( أ ,ب ,ت ,ث ,…).
tomListNumberedArabic2Arabic abjadi ( أ ,ب ,ج ,د ,…).
tomListNumberedHebrewHebrew alphabet (א, ב, ג, ד, …).
tomListNumberedThaiAlphaThai alphabetic (ก, ข,ค, ง, …).
tomListNumberedThaiNumThai numbers (๑, ๒,๓, ๔…).
tomListNumberedHindiAlphaHindi vowels (अ, आ, इ, ई, …).
tomListNumberedHindiAlpha1Hindi consonants (क, ख, ग, घ, …).
tomListNumberedHindiNumHindi numbers (१, २, ३, ४, …).

By default, numbers are followed by a right parenthesis, for example: 1). However, the returnes value can include one of the following flags to indicate a different formatting.

ValueMeaning
tomListMinusFollows the number with a hyphen (-).
tomListParenthesesEncloses the number in parentheses, as in: (1).
tomListPeriodFollows the number with a period.
tomListPlainUses the number alone.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

Values above 32 correspond to Unicode values for bullets.


SetListType

Sets the type of list to be used for paragraphs.

FUNCTION SetListType (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueNew list type.
ValueMeaning
tomListNoneNot a list paragraph.
tomListBulletList uses bullets (&h2022); other bullets are given by > 32.
tomListNumberAsArabicList is numbered with Arabic numerals (0, 1, 2, ...).
tomListNumberAsLCLetterList is ordered with lowercase letters (a, b, c, ...).
tomListNumberAsUCLetterList is ordered with uppercase Arabic letters (A, B, C, ...).
tomListNumberAsLCRomanList is ordered with lowercase Roman letters (i, ii, iii, ...).
tomListNumberAsUCRomanList is ordered with uppercase Roman letters (I, II, III, ...).
tomListNumberAsSequenceThe value returned by GetListStart is treated as the first code in a Unicode sequence.
tomListNumberedCircleList is ordered with Unicode circled numbers.
tomListNumberedBlackCircleWingdingList is ordered with Wingdings black circled digits.
tomListNumberedArabicWideFull-width ASCII (0, 1, 2, 3, …).
tomListNumberedChSChinese with 十 only in items 10 through 99. (一, 二, 三, 四…).
tomListNumberedChTChinese with 十 only in items 10 through 19.
tomListNumberedJpnChsChinese with a full-width period, no 十.
tomListNumberedJpnKorChinese with no 十.
tomListNumberedArabic1Arabic alphabetic ( أ ,ب ,ت ,ث ,…).
tomListNumberedArabic2Arabic abjadi ( أ ,ب ,ج ,د ,…).
tomListNumberedHebrewHebrew alphabet (א, ב, ג, ד, …).
tomListNumberedThaiAlphaThai alphabetic (ก, ข,ค, ง, …).
tomListNumberedThaiNumThai numbers (๑, ๒,๓, ๔…).
tomListNumberedHindiAlphaHindi vowels (अ, आ, इ, ई, …).
tomListNumberedHindiAlpha1Hindi consonants (क, ख, ग, घ, …).
tomListNumberedHindiNumHindi numbers (१, २, ३, ४, …).

By default, numbers are followed by a right parenthesis, for example: 1). However, the returnes value can include one of the following flags to indicate a different formatting.

ValueMeaning
tomListMinusFollows the number with a hyphen (-).
tomListParenthesesEncloses the number in parentheses, as in: (1).
tomListPeriodFollows the number with a period.
tomListPlainUses the number alone.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetNoLineNumber

Determines whether paragraph numbering is enabled.

FUNCTION GetNoLineNumber () AS LONG
Return value

One of the following values to indicate the kind of list numbering.

ValueMeaning
tomTrueLine numbering is disabled.
tomFalseLine numbering is enabled.
tomUndefinedThe property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

Paragraph numbering is when the paragraphs of a range are numbered. The number appears on the first line of a paragraph.


SetNoLineNumber

Determines whether to suppress line numbering of paragraphs in a range.

FUNCTION SetNoLineNumber (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueIndicates if line numbering is suppressed. It can be one of the following possible values.
ValueMeaning
tomTrueLine numbering is disabled.
tomFalseLine numbering is enabled.
tomUndefinedThe property is undefined.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetPageBreakBefore

Determines whether each paragraph in the range must begin on a new page.

FUNCTION GetPageBreakBefore () AS LONG
Return value

One of the following values:

ValueMeaning
tomTrueEach paragraph in this range must begin on a new page.
tomFalseThe paragraphs in this range do not need to begin on a new page.
tomUndefinedThe property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetPageBreakBefore

Controls whether there is a page break before each paragraph in a range.

FUNCTION SetPageBreakBefore (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueA tomBool value that controls page breaks before paragraphs. It can be one of the following values.
ValueMeaning
tomTrueParagraphs in this range must begin on a new page.
tomFalseParagraphs in this range do not need to begin on a new page.
tomToggleToggle the property value.
tomUndefinedThe property is undefined.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text.


GetRightIndent

Retrieves the size of the right margin indent of a paragraph.

FUNCTION GetRightIndent () AS SINGLE
Return value

The right indentation, in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetRightIndent

Sets the right margin of paragraph.

FUNCTION SetRightIndent (BYVAL Value AS SINGLE) AS HRESULT
ParameterDescription
ValueRight indent, in floating-point points.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetIndents

Sets the first-line indent, the left indent, and the right indent for a paragraph.

FUNCTION SetIndents (BYVAL First AS SINGLE, BYVAL Left AS SINGLE, BYVAL Right AS SINGLE) AS HRESULT
ParameterDescription
FirstIndent of the first line in a paragraph, relative to the left indent. The value is in floating-point points and can be positive or negative.
LeftLeft indent of all lines except the first line in a paragraph, relative to left margin. The value is in floating-point points and can be positive or negative.
RightRight indent of all lines in paragraph, relative to the right margin. The value is in floating-point points and can be positive or negative. This value is optional.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

Line indents are not allowed to position text in the margins. If the first-line indent is set to a negative value (for an outdented paragraph) while the left indent is zero, the first-line indent is reset to zero. To avoid this problem while retaining property sets, set the first-line indent value equal to zero either explicitly or by calling the Reset method. Then, call SetIndents to set a nonnegative, left-indent value and set the desired first-line indent.


SetLineSpacing

Sets the paragraph line-spacing rule and the line spacing for a paragraph.

FUNCTION SetLineSpacing (BYVAL Rule AS LONG, BYVAL Spacing AS SINGLE) AS HRESULT
ParameterDescription
RuleValue of new line-spacing rule.
SpacingValue of new line spacing. If the line-spacing rule treats the Spacing value as a linear dimension, then Spacing is given in floating-point points.
Line spacing ruleMeaning
tomLineSpaceSingleSingle spacing. The line-spacing value is ignored.
tomLineSpace1pt5One-and-a-half line spacing. The line-spacing value is ignored.
tomLineSpaceDoubleDouble line spacing. The line-spacing value is ignored.
tomLineSpaceAtLeastThe line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less than single spacing, the control displays single-spaced text.
tomLineSpaceExactlyThe line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is less than single spacing).
tomLineSpaceMultipleThe line-spacing value specifies the line spacing, in lines.
tomLineSpacePercentThe line-spacing value specifies the line spacing by percent of line height.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

The line-spacing rule and line spacing work together, and as a result, they must be set together, much as the first and left indents need to be set together.


GetSpaceAfter

Retrieves the amount of vertical space below a paragraph.

FUNCTION GetSpaceAfter () AS SINGLE
Return value

The space-after value, in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetSpaceAfter

Sets the amount of space that follows a paragraph.

FUNCTION SetSpaceAfter (BYVAL Value AS SINGLE) AS HRESULT
ParameterDescription
ValueNew space-after value, in floating-point points.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetSpaceBefore

Retrieves the amount of vertical space above a paragraph.

FUNCTION GetSpaceBefore () AS SINGLE
Return value

The space-before value, in floating-point points.

Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetSpaceBefore

Sets the amount of space preceding a paragraph.

FUNCTION SetSpaceBefore (BYVAL Value AS SINGLE) AS HRESULT
ParameterDescription
ValueNew space-before value, in floating-point points.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetWidowControl

Retrieves the widow and orphan control state for the paragraphs in a range.

FUNCTION GetWidowControl () AS LONG
Return value

A tomBool value that indicates the state of widow and orphan control. It can be one of the following values.

ValueMeaning
tomTruePrevents the printing of a widow or orphan
tomFalseAllows the printing of a widow or orphan.
tomUndefinedThe widow-control property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

SetWidowControl

Controls the suppression of widows and orphans.

FUNCTION SetWidowControl (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueA tomBool value that controls the suppression of widows and orphans. It can be one of the following possible values.
ValueMeaning
tomTruePrevents printing of widows and orphans.
tomFalseAllows printing of widows and orphans.
tomToggleThe value is toggled.
tomUndefinedNo change.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetTabCount

Retrieves the tab count.

FUNCTION GetTabCount () AS LONG
Return value

The tab count.

ValueMeaning
tomTruePrevents the printing of a widow or orphan.
tomFalseAllows the printing of a widow or orphan.
tomUndefinedThe widow-control property is undefined.
Result code

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

The tab count of a new instance can be nonzero, depending on the underlying text engine. For example, Microsoft Word stories begin with no explicit tabs defined, while rich edit instances start with a single explicit tab. To be sure there are no explicit tabs (that is, to set the tab count to zero), call ClearAllTabs.


AddTab

Adds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader.

FUNCTION AddTab (BYVAL tbPos AS SINGLE, BYVAL tbAlign AS LONG, BYVAL tbLeader AS LONG) AS HRESULT
ParameterDescription
tbPosNew tab displacement, in floating-point points.
tbAlignAlignment options for the tab position. It can be one of the following.
ValueMeaning
tomAlignLeftText is left justified from the tab position. This is the default.
tomAlignCenterText is centered on the tab position.
tomAlignDecimalThe decimal point is set at the tab position. This is useful for aligning a column of decimal numbers.
tomAlignBarA vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form a continuous vertical line.
ParameterDescription
tbLeaderLeader character style. A leader character is the character that is used to fill the space taken by a tab character. It can be one of the following.
ValueMeaning
tomSpacesSpaces are used. This is the default.
tomDotsDots are used.
tomDashesA dashed line is used.
tomLinesA solid line is used.
Return value

If the method succeeds, GetLastResult returns S_OK. If the method fails, it returns the following COM error code.

Result codeDescription
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
Remarks

It is assumed that there is never a tab at position zero. If multiple paragraphs are described, the common subset of tabs will be returned with &h8000 in the upper word of the tab type.


ClearAllTabs

Clears all tabs, reverting to equally spaced tabs with the default tab spacing.

FUNCTION ClearAllTabs () AS HRESULT
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

DeleteTab

Deletes a tab at a specified displacement.

FUNCTION DeleteTab (BYVAL tbPos AS SINGLE) AS HRESULT
ParameterDescription
tbPosDisplacement, in floating-point points, at which a tab should be deleted.
Return value

If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
E_ACCESSDENIEDWrite access is denied.
E_OUTOFMEMORYInsufficient memory.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.

GetTab

Retrieves tab parameters (displacement, alignment, and leader style) for a specified tab.

FUNCTION GetTab (BYVAL iTab AS LONG, BYVAL ptbPos AS SINGLE PTR, BYVAL ptbAlign AS LONG PTR, _
   BYVAL ptbLeader AS LONG PTR) AS HRESULT
ParameterDescription
iTabIndex of tab for which to retrieve info. It can be either a numerical index or a special value (see the following table). Since tab indexes are zero-based, iTab = zero gets the first tab defined, iTab = 1 gets the second tab defined, and so forth. The following table summarizes all of the possible values of ^iTab*.
iTabValueMeaning
tomTabBack-3Get tab previous to * ptbPos
tomTabNext-2Get tab following * ptbPos
tomTabHere-1Get tab at * ptbPos
>= 0Get tab with index of iTab (and ignore ptbPos).
ParameterDescription
ptbPosThe tab displacement, in floating-point points. The value of * ptbPos is zero if the tab does not exist and the value of * ptbPos is tomUndefined if there are multiple values in the associated range.
ptbAlignThe tab alignment.
ValueMeaning
tomAlignLeftText is left justified from the tab position. This is the default.
tomAlignCenterText is centered on the tab position.
tomAlignDecimalThe decimal point is set at the tab position. This is useful for aligning a column of decimal numbers.
tomAlignBarA vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form a continuous vertical line.
ParameterDescription
ptbLeaderThe tab leader-character style.
ValueMeaning
tomSpacesSpaces are used. This is the default.
tomDotsDots are used.
tomDashesA dashed line is used.
tomLinesA solid line is used.
Return value

If GetTab succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.

Result codeDescription
E_INVALIDARGInvalid argument.
CO_E_RELEASEDThe paragraph formatting object is attached to a range that has been deleted.
S_FALSEThere is no tab corresponding to iTab.

GetBorders

Not implemented. Gets the borders collection.

FUNCTION GetBorders () AS IUnknown PTR
Return value

The borders collection.

Result code

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.


GetFontAlignment

Gets the paragraph font alignment state.

FUNCTION GetFontAlignment () AS LONG
Return value

The paragraph font alignment state. It can be one of the following values.

Font AlignmentStates
tomFontAlignmentAuto (default)For horizontal layout, align CJK characters on the baseline. For vertical layout, center align CJK characters.
tomFontAlignmentTopFor horizontal layout, top align CJK characters. For vertical layout, right align CJK characters.
tomFontAlignmentBaselineFor horizontal or vertical layout, align CJK characters on the baseline.
tomFontAlignmentBottomFor horizontal layout, bottom align CJK characters. For vertical layout, left align CJK characters.
tomFontAlignmentCenterFor horizontal layout, center CJK characters vertically. For vertical layout, center align CJK characters horizontally.
Result code

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.


SetFontAlignment

Sets the paragraph font alignment for Chinese, Japanese, Korean text.

FUNCTION SetFontAlignment (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueThe paragraph font alignment. It can be one of the following values.
Return value

The paragraph font alignment state. It can be one of the following values.

Font AlignmentStates
tomFontAlignmentAuto (default)For horizontal layout, align CJK characters on the baseline. For vertical layout, center align CJK characters.
tomFontAlignmentTopFor horizontal layout, top align CJK characters. For vertical layout, right align CJK characters.
tomFontAlignmentBaselineFor horizontal or vertical layout, align CJK characters on the baseline.
tomFontAlignmentBottomFor horizontal layout, bottom align CJK characters. For vertical layout, left align CJK characters.
tomFontAlignmentCenterFor horizontal layout, center CJK characters vertically. For vertical layout, center align CJK characters horizontally.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.


GetHangingPunctuation

Gets whether to hang punctuation symbols on the right margin when the paragraph is justified.

FUNCTION GetHangingPunctuation () AS LONG
Return value

A tomBool value that can be one of the following.

ValueMeaning
tomTrueHang punctuation symbols on the right margin.
tomFalseDo not hang punctuation symbols on the right margin.
tomUndefinedThe HangingPunctuation property is undefined.
Result code

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.


SetHangingPunctuation

Sets whether to hang punctuation symbols on the right margin when the paragraph is justified.

FUNCTION SetHangingPunctuation (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueA tomBool value that can be one of the following.
ValueMeaning
tomTrueHang punctuation symbols on the right margin.
tomFalseDo not hang punctuation symbols on the right margin.
tomToggleToggle the HangingPunctuation property.
tomUndefinedThe HangingPunctuation property is undefined.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.


GetSnapToGrid

Gets whether paragraph lines snap to a vertical grid that could be defined for the whole document.

FUNCTION GetSnapToGrid () AS LONG
Return value

A tomBool value that can be one of the following.

ValueMeaning
tomTrueParagraph lines snap to a vertical grid.
tomFalseParagraph lines do not snap to a grid.
tomUndefinedThe SnapToGrid property is undefined.
Result code

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.


SetSnapToGrid

Sets whether paragraph lines snap to a vertical grid that could be defined for the whole document.

FUNCTION SetSnapToGrid (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueA tomBool value that can be one of the following.
ValueMeaning
tomTrueParagraph lines snap to a vertical grid.
tomFalseParagraph lines do not snap to a grid.
tomToggleToggle the SnapToGrid property.
tomUndefinedThe SnapToGrid property is undefined.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.


GetTrimPunctuationAtStart

Gets whether to trim the leading space of a punctuation symbol at the start of a line.

FUNCTION GetTrimPunctuationAtStart () AS LONG
Return value

A tomBool value that can be one of the following.

ValueMeaning
tomTrueTrim the leading space of a punctuation symbol at the start of a line.
tomFalseDo not trim the leading space of a punctuation symbol at the start of a line.
tomUndefinedThe TrimPunctuationAtStart property is undefined.
Result code

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.


SetTrimPunctuationAtStart

Sets whether to trim the leading space of a punctuation symbol at the start of a line.

FUNCTION SetTrimPunctuationAtStart (BYVAL Value AS LONG) AS HRESULT
ParameterDescription
ValueA tomBool that indicates whether to trim the leading space of a punctuation symbol. It can be one of the following values.
ValueMeaning
tomTrueTrim the leading space of a punctuation symbol at the start of a line.
tomFalseDo not trim the leading space of a punctuation symbol at the start of a line.
tomToggleToggle the TrimPunctuationAtStart property.
tomUndefinedThe TrimPunctuationAtStart property is undefined.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.


GetEffects

Gets the paragraph format effects.

FUNCTION GetEffects (BYVAL pValue AS LONG PTR, BYVAL pMask AS LONG PTR) AS HRESULT
ParameterDescription
pValueThe paragraph effects. This value can be a combination of the following flags.
FlagMeaning
tomParaEffectRTLRight-to-left paragraph.
tomParaEffectKeepKeep the paragraph together.
tomParaEffectPageBreakBeforePut a page break before this paragraph.
tomParaEffectNoLineNumberNo line number for this paragraph.
tomParaEffectNoWidowControlNo widow control.
tomParaEffectDoNotHyphenDon't hyphenate this paragraph.
tomParaEffectSideBySideSide by side.
tomParaEffectCollapsedHeading contents are collapsed (in outline view).
tomParaEffectOutlineLevelOutline view nested level.
tomParaEffectBoxParagraph has boxed effect (is not displayed).
tomParaEffectTableRowDelimiterAt or inside table delimiter.
tomParaEffectTableInside or at the start of a table.
ParameterDescription
pMaskThe differences in the flags over the range. A value of 1 indicates that the corresponding effect is the same over the range. For an insertion point, the values equal 1 for all defined effects.
Return value

If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.

Remarks

If the tomTable flag is set, you can use the GetTable method to get more table properties.


SetEffects

Sets the paragraph format effects.

FUNCTION SetEffects (BYVAL Value AS LONG, BYVAL Mask AS LONG) AS HRESULT
ParameterDescription
ValueThe paragraph effects value. This value can be a combination of the flags defined in the table below.
MaskThe desired mask. This value can be a combination of the flags defined in the table below. Only effects with the corresponding mask flag set are modified.
FlagMeaning
tomParaEffectRTLRight-to-left paragraph.
tomParaEffectKeepKeep the paragraph together.
tomParaEffectPageBreakBeforePut a page break before this paragraph.
tomParaEffectNoLineNumberNo line number for this paragraph.
tomParaEffectNoWidowControlNo widow control.
tomParaEffectDoNotHyphenDon't hyphenate this paragraph.
tomParaEffectSideBySideSide by side.
tomParaEffectCollapsedHeading contents are collapsed (in outline view).
tomParaEffectOutlineLevelOutline view nested level.
tomParaEffectBoxParagraph has boxed effect (is not displayed).
tomParaEffectTableRowDelimiterAt or inside table delimiter.
tomParaEffectTableInside or at the start of a table.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.


GetProperty

Gets the value of the specified property.

FUNCTION GetProperty (BYVAL nType AS LONG) AS LONG
ParameterDescription
nTypeThe ID of the property value to retrieve.
Return value

The property value.

Result code

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.

Remarks

The tomParaPropMathAlign property sets the math alignment for math paragraphs in a text paragraph. It can have one of the following values.

ValueMeaning
tomMathParaAlignDefaultThe default alignment for math paragraphs.
tomMathParaAlignCenterGroupCenter math paragraphs as a group.
tomMathParaAlignCenterCenter math paragraphs.
tomMathParaAlignLeftLeft-align math paragraphs.
tomMathParaAlignRightRight-align math paragraphs.

SetProperty

Sets the value of the specified property.

FUNCTION SetProperty (BYVAL nType AS LONG, BYVAL Value AS LONG) AS HRESULT
ParameterDescription
nTypeThe ID of the property value to set.
nTypeThe property value to set.
Return value

If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.

Remarks

The tomParaPropMathAlign property sets the math alignment for math paragraphs in a text paragraph. It can have one of the following values.

ValueMeaning
tomMathParaAlignDefaultThe default alignment for math paragraphs.
tomMathParaAlignCenterGroupCenter math paragraphs as a group.
tomMathParaAlignCenterCenter math paragraphs.
tomMathParaAlignLeftLeft-align math paragraphs.
tomMathParaAlignRightRight-align math paragraphs.