Edit

Share via


Word.GetTextOptions interface

Specifies the options to be included in a Paragraph.getText operation.

Remarks

[ API set: WordApi 1.7 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/25-paragraph/get-text.yaml

await Word.run(async (context) => {
  const paragraph: Word.Paragraph = context.document.getSelection().paragraphs.getFirst();

  const text = paragraph.getText();
  const textIncludingHidden = paragraph.getText({ IncludeHiddenText: true });
  const textIncludingDeleted = paragraph.getText({ IncludeTextMarkedAsDeleted: true });

  await context.sync();

  console.log("Text:- " + text.value, "Including hidden text:- " + textIncludingHidden.value, "Including text marked as deleted:- " + textIncludingDeleted.value);
});

Properties

includeHiddenText

If provided, specifies whether to include hidden text in the result of the Paragraph.getText method. The default value is false.

includeTextMarkedAsDeleted

If provided, specifies whether to include text marked as deleted in the result of the Paragraph.getText method. The default value is false.

Property Details

includeHiddenText

If provided, specifies whether to include hidden text in the result of the Paragraph.getText method. The default value is false.

includeHiddenText?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.7 ]

includeTextMarkedAsDeleted

If provided, specifies whether to include text marked as deleted in the result of the Paragraph.getText method. The default value is false.

includeTextMarkedAsDeleted?: boolean;

Property Value

boolean

Remarks

[ API set: WordApi 1.7 ]