Hide Table of Contents
SetTextFormat Method (IAnnotation)

Sets the text format information for the specified text within this annotation.

.NET Syntax

Visual Basic (Declaration) 
Function SetTextFormat( _
   ByVal Index As Integer, _
   ByVal UseDoc As Boolean, _
   ByVal TextFormat As Object _
) As Boolean
Visual Basic (Usage) 
Dim instance As IAnnotation
Dim Index As Integer
Dim UseDoc As Boolean
Dim TextFormat As Object
Dim value As Boolean
value = instance.SetTextFormat(Index, UseDoc, TextFormat)
bool SetTextFormat( 
   int Index,
   bool UseDoc,
   object TextFormat
bool SetTextFormat( 
&   int Index,
&   bool UseDoc,
&   Object^ TextFormat



Number indicating which text within this annotation to check


True to use the document default setting for text format, false to not


Object to use for the ITextFormat on the specified piece of text

Return Value

True if this method is successful in setting the text format information, false if not



The behavior of this method differs depending on the type of annotation.

    • Datum Target and Datum Feature Symbols

      These symbols always use the document default setting for dimension text format to display all of the text objects within the symbol. This method has no effect on the annotation.
    • Geometric Tolerance, Display Dimensions, Simple Notes, Surface Finish, and Weld Symbols

      These symbols can use the document default setting for display of all text objects within the symbol (dimension text setting for the geometric tolerance symbols and display dimensions, or note text setting for notes) or they can use a local format. The index argument is not used and should be set to 0.
    • Blocks and Compound Notes

      These symbols might contain several different pieces of text; each piece can use the document default setting for notes or a local format. The index argument identifies the text. The index value is 0 based. If the index value is invalid, then this method returns false. To get the number of text or TextFormat objects, use IAnnotation::GetTextFormatCount.
    • Rich Text Format

      If a notes contains embedded rich text information in the string, then using this method to set a specific text format has no effect and returns false. If you use this method to set the note to use the document default text format, then all of the rich text font information is removed from the string.

      To set a specific text format for a note that contains embedded rich text information, perform these two steps. First use this method to set the document default. Then use this method to set the specific text format.

If the useDoc argument is True, then the annotation is set to use the appropriate document default setting and ignores the textFormat argument, which should be set to NULL. To determine whether or not this annotation is using the document default settings for text format, use IAnnotation::GetUseDocTextFormat. To set the text format information, use IAnnotation::SetTextFormat or IAnnotation::ISetTextFormat.

To see the effects of changing the text format information for this annotation, use ModelDoc2::GraphicsRedraw2.


See Also


SolidWorks 2000 FCS, Revision Number 8.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   SetTextFormat Method (IAnnotation)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.