OfficeIMO

API Reference

Class

WordTextBox

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

WordTextBox class

Inheritance

Constructors

WordTextBox 4 overloads
public WordTextBox(WordDocument wordDocument, Paragraph paragraph, Run run) #

Add a new text box to the document

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
text System.String requiredposition: 1
wrapTextImage OfficeIMO.Word.WrapTextImage requiredposition: 2
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 required
paragraph DocumentFormat.OpenXml.Wordprocessing.Paragraph required
run DocumentFormat.OpenXml.Wordprocessing.Run required
public WordTextBox(WordDocument wordDocument, WordParagraph paragraph, String text, WrapTextImage wrapTextImage) #

Create a text box in a header or footer

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
wordHeaderFooter OfficeIMO.Word.WordHeaderFooter requiredposition: 1
text System.String requiredposition: 2
wrapTextImage OfficeIMO.Word.WrapTextImage requiredposition: 3
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 required
paragraph OfficeIMO.Word.WordParagraph required
text System.String required
wrapTextImage OfficeIMO.Word.WrapTextImage required

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 required
expectedPositionOffset System.Boolean required
public TextBoxContent GenerateTextBoxContent(String text) #
Returns: TextBoxContent

Generates TextBoxContent from text

Parameters

text System.String requiredposition: 0
public Void Remove() #
Returns: Void

Removes the text box from the document along with the paragraph

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 Int64 Width { get; set; } #

Width of the text box

public Int64 Height { get; set; } #

Height of the text box

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