Word.Critique interface
Critique that will be rendered as underline for the specified part of paragraph in the document.
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-annotations.yaml
// Adds annotations to the selected paragraph.
await Word.run(async (context) => {
const paragraph: Word.Paragraph = context.document.getSelection().paragraphs.getFirst();
const options: Word.CritiquePopupOptions = {
brandingTextResourceId: "PG.TabLabel",
subtitleResourceId: "PG.HelpCommand.TipTitle",
titleResourceId: "PG.HelpCommand.Label",
suggestions: ["suggestion 1", "suggestion 2", "suggestion 3"]
};
const critique1: Word.Critique = {
colorScheme: Word.CritiqueColorScheme.red,
start: 1,
length: 3,
popupOptions: options
};
const critique2: Word.Critique = {
colorScheme: Word.CritiqueColorScheme.green,
start: 6,
length: 1,
popupOptions: options
};
const critique3: Word.Critique = {
colorScheme: Word.CritiqueColorScheme.blue,
start: 10,
length: 3,
popupOptions: options
};
const critique4: Word.Critique = {
colorScheme: Word.CritiqueColorScheme.lavender,
start: 14,
length: 3,
popupOptions: options
};
const critique5: Word.Critique = {
colorScheme: Word.CritiqueColorScheme.berry,
start: 18,
length: 10,
popupOptions: options
};
const annotationSet: Word.AnnotationSet = {
critiques: [critique1, critique2, critique3, critique4, critique5]
};
const annotationIds = paragraph.insertAnnotations(annotationSet);
await context.sync();
console.log("Annotations inserted:", annotationIds.value);
});
Properties
color |
Gets the color scheme of the critique. |
length | Gets the length of the critique inside paragraph. |
start | Gets the start index of the critique inside paragraph. |
Property Details
colorScheme
Gets the color scheme of the critique.
colorScheme: Word.CritiqueColorScheme | "Red" | "Green" | "Blue" | "Lavender" | "Berry";
Property Value
Word.CritiqueColorScheme | "Red" | "Green" | "Blue" | "Lavender" | "Berry"
Remarks
length
Gets the length of the critique inside paragraph.
length: number;
Property Value
number
Remarks
start
Gets the start index of the critique inside paragraph.
start: number;
Property Value
number
Remarks
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for