API Reference
WordTextBox
WordTextBox class
Inheritance
- WordElement
- WordTextBox
Constructors
public WordTextBox(WordDocument wordDocument, Paragraph paragraph, Run run) #Add a new text box to the document
Parameters
- wordDocument OfficeIMO.Word.WordDocument
- text System.String
- wrapTextImage OfficeIMO.Word.WrapTextImage
WordTextBox(OfficeIMO.Word.WordDocument wordDocument, DocumentFormat.OpenXml.Wordprocessing.Paragraph paragraph, DocumentFormat.OpenXml.Wordprocessing.Run run) #Initialize a text box from an existing paragraph
Parameters
- wordDocument OfficeIMO.Word.WordDocument
- paragraph DocumentFormat.OpenXml.Wordprocessing.Paragraph
- run DocumentFormat.OpenXml.Wordprocessing.Run
WordTextBox(OfficeIMO.Word.WordDocument wordDocument, OfficeIMO.Word.WordParagraph paragraph, System.String text, OfficeIMO.Word.WrapTextImage wrapTextImage) #Create a text box from an existing paragraph
Parameters
- wordDocument OfficeIMO.Word.WordDocument
- paragraph OfficeIMO.Word.WordParagraph
- text System.String
- wrapTextImage OfficeIMO.Word.WrapTextImage
Methods
AddHorizontalPosition(DocumentFormat.OpenXml.Drawing.Wordprocessing.Anchor anchor, System.Boolean expectedPositionOffset) #Small helper to create horizontal position if it doesn't exist
Parameters
- anchor DocumentFormat.OpenXml.Drawing.Wordprocessing.Anchor
- expectedPositionOffset System.Boolean
public TextBoxContent GenerateTextBoxContent(String text) #TextBoxContentGenerates TextBoxContent from text
Parameters
- text System.String
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public List<WordParagraph> Paragraphs { get; } #Gets a list of WordParagraph instances representing the paragraphs in the text box. Each WordParagraph is initialized with the WordDocument, the Paragraph, and the Run.
public List<WordElement> Elements { get; } #Gets the direct child elements contained in the text box in document order.
public Nullable<HorizontalRelativePositionValues> HorizontalPositionRelativeFrom { get; set; } #Gets or sets horizontal relative position of the text box
public Nullable<WrapTextImage> WrapText { get; set; } #Gets or sets the wrap text of the text box
public WordHorizontalAlignmentValues HorizontalAlignment { get; set; } #Gets or sets the horizontal alignment of the text box
public VerticalRelativePositionValues VerticalPositionRelativeFrom { get; set; } #Gets or sets the relative4 vertical alignment of the text box
public Nullable<Int32> VerticalPositionOffset { get; set; } #Allows to set vertically position of the text box in twips (twentieths of a point)
public Nullable<Int32> HorizontalPositionOffset { get; set; } #Allows to set vertically position of the text box in twips (twentieths of a point) Please remember that this property will remove alignment of the text box and instead use Absolute position
public Nullable<Double> HorizontalPositionOffsetCentimeters { get; set; } #Allows to set horizontally position of the text box in centimeters
public Nullable<Double> VerticalPositionOffsetCentimeters { get; set; } #Allows to set vertically position of the text box in centimeters
public Nullable<Int32> RelativeWidthPercentage { get; set; } #Gets or sets the relative width percentage
public Nullable<Int32> RelativeHeightPercentage { get; set; } #Gets or sets the relative height percentage
public TextBodyProperties TextBodyProperties { get; } #Gets text body properties
public WordTextBoxAutoFitType AutoFit { get; set; } #Gets or sets the AutoFit behavior for the textbox.
public Boolean AutoFitToTextSize { get; set; } #Gets or sets whether the textbox resizes to fit text. Use AutoFit for more options.
public Nullable<SizeRelativeHorizontallyValues> SizeRelativeHorizontally { get; set; } #Sets size relative horizontally
public Double WidthCentimeters { get; set; } #Width of the text box in centimeters Sets the width of the text box in centimeters Sets the relative width percentage to 0 as it seems to be required
public Double HeightCentimeters { get; set; } #Height of the text box in centimeters Sets the height of the text box in centimeters Sets the relative height percentage to 0 as it seems to be required