Skip to main content

OperationKind

Enum OperationKind 

Source
pub enum OperationKind {
Show 26 variants Replace { paragraph: Selector, find: String, replacement: String, format: Option<RunFormat>, comment: Option<String>, whole: bool, occurrence: Option<usize>, }, Insert { paragraph: Selector, after: Option<String>, before: Option<String>, position: Option<Edge>, text: String, format: Option<RunFormat>, comment: Option<String>, occurrence: Option<usize>, }, Delete { paragraph: Selector, find: String, occurrence: Option<usize>, comment: Option<String>, }, Comment { paragraph: Selector, find: Option<String>, text: String, through: Option<Selector>, occurrence: Option<usize>, }, InsertParagraph { paragraph: Selector, position: Side, runs: Vec<RunSpec>, like: Option<Selector>, style: Option<String>, comment: Option<String>, }, DeleteParagraph { paragraph: Selector, comment: Option<String>, }, FormatParagraph { paragraph: Selector, style: Option<String>, alignment: Option<Alignment>, line_spacing: Option<LineSpacing>, space_before: Option<Points>, space_after: Option<Points>, }, MergeParagraphs { paragraph: Selector, separator: Option<String>, }, Rewrite { paragraph: Selector, text: String, comment: Option<String>, }, ReplyComment { comment_id: u32, text: String, }, ResolveComment { comment_id: u32, done: bool, }, EditComment { comment_id: u32, text: String, }, DeleteComment { comment_id: u32, }, Strike { revision: String, comment: Option<String>, }, Restore { revision: String, comment: Option<String>, }, InsertTable { paragraph: Selector, position: Side, rows: Vec<Vec<String>>, header_row: bool, widths_dxa: Option<Vec<u32>>, style: Option<String>, }, List { paragraphs: Vec<Selector>, kind_of_list: ListKind, level: u32, restart: bool, }, Watermark { text: String, color: Option<String>, diagonal: Option<bool>, font: Option<String>, }, FillControl { control: ControlSelector, text: Option<String>, choice: Option<String>, checked: Option<bool>, date: Option<String>, }, FormatRun { paragraph: Selector, find: String, format: RunFormat, occurrence: Option<usize>, }, InsertFootnote { paragraph: Selector, after: String, text: String, occurrence: Option<usize>, }, InsertImage { paragraph: Selector, position: Side, image_base64: String, content_type: Option<String>, width_emu: Option<u64>, alt: Option<String>, }, PageSetup { section: SectionScope, page: Option<PageSize>, orientation: Option<Orientation>, margins_dxa: Margins, }, InsertToc { paragraph: Selector, position: Side, levels: u8, title: Option<String>, }, Redact { paragraph: Selector, find: String, occurrence: Option<usize>, }, Settings { track_revisions: Option<bool>, update_fields: Option<bool>, protection: Option<Protection>, },
}
Expand description

The supported operation kinds (wire tag kind).

Variants§

§

Replace

Replace exactly one occurrence of find in the paragraph.

Fields

§paragraph: Selector

Paragraph to edit; must match exactly one.

§find: String

Exact text to locate; must occur exactly once.

§replacement: String

Replacement text (may be empty); \t writes a tab, \n a line break.

§format: Option<RunFormat>

Formatting of the replacement on top of the replaced run’s.

§comment: Option<String>

Comment text anchored to the changed text; blank is none.

§whole: bool

Show the change as all of find deleted, then all of replacement inserted, instead of Word Compare’s word-level diff.

§occurrence: Option<usize>

Which hit of a repeated anchor to use (1-based); required when the anchor occurs more than once.

§

Insert

Insert text after/before exactly one occurrence of an anchor, or at the paragraph’s start/end. Exactly one of after, before, position must be given.

Fields

§paragraph: Selector

Paragraph to edit; must match exactly one.

§after: Option<String>

Insert right after this unique anchor text.

§before: Option<String>

Insert right before this unique anchor text.

§position: Option<Edge>

Insert at the paragraph start or end.

§text: String

Text to insert; \t writes a tab, \n a line break.

§format: Option<RunFormat>

Formatting of the new text on top of the neighbouring run’s.

§comment: Option<String>

Comment text anchored to the changed text; blank is none.

§occurrence: Option<usize>

Which hit of a repeated anchor to use (1-based); required when the anchor occurs more than once.

§

Delete

Delete exactly one occurrence of find.

Fields

§paragraph: Selector

Paragraph to edit; must match exactly one.

§find: String

Exact text to delete; must occur exactly once.

§occurrence: Option<usize>

Which hit of a repeated anchor to use (1-based); required when the anchor occurs more than once.

§comment: Option<String>

Comment on the deleted text, blank is none. It is in the redline only: the clean copy no longer holds the text.

§

Comment

Comment on exactly one occurrence of find, or on the whole paragraph. The range may cross tabs, symbols, hyperlinks, fields, content controls and revisions: a comment edits nothing.

Fields

§paragraph: Selector

Paragraph to edit; must match exactly one.

§find: Option<String>

Text to anchor the comment to; whole paragraph when omitted.

§text: String

The comment, plain text; each \n starts a new comment paragraph.

§through: Option<Selector>

Last paragraph of a range from the start of paragraph to the end of this one (same story, not before paragraph); find must be left out.

§occurrence: Option<usize>

Which hit of a repeated anchor to use (1-based); required when the anchor occurs more than once.

§

InsertParagraph

Insert a new paragraph next to the anchor paragraph, copying its paragraph properties (never its section break or revision marks), or those of like.

Fields

§paragraph: Selector

Paragraph to edit; must match exactly one.

§position: Side

Which side of the anchor paragraph.

§runs: Vec<RunSpec>

Runs of the new paragraph, in order.

§like: Option<Selector>

Paragraph whose properties and run formatting the new paragraph copies instead of the anchor’s: a plain paragraph inserted after a list item, for one.

§style: Option<String>

Paragraph style id to set instead of the anchor’s.

§comment: Option<String>

Comment text anchored to the changed text; blank is none.

§

DeleteParagraph

Delete a whole paragraph, mark included.

Fields

§paragraph: Selector

Paragraph to delete; must match exactly one.

§comment: Option<String>

Comment on the deleted text, blank is none. It is in the redline only: the clean copy has no paragraph to hold it.

§

FormatParagraph

Change a paragraph’s style, alignment or spacing; the redline records the old properties (w:pPrChange). At least one field besides paragraph.

Fields

§paragraph: Selector

Paragraph to format; must match exactly one.

§style: Option<String>

Paragraph style, by id (Heading1) or name (heading 1).

§alignment: Option<Alignment>

Horizontal alignment.

§line_spacing: Option<LineSpacing>

Line spacing as a multiple of single spacing (1.5, 2).

§space_before: Option<Points>

Space before the paragraph, in points.

§space_after: Option<Points>

Space after the paragraph, in points.

§

MergeParagraphs

Join the paragraph with the one right after it. The first’s text moves to the start of the second, whose paragraph properties (and section break) survive, as when Word accepts a deleted paragraph mark. The redline deletes the first paragraph’s mark.

Fields

§paragraph: Selector

First paragraph; the next paragraph must follow it directly.

§separator: Option<String>

Plain text placed between the two (for example " ").

§

Rewrite

Make the paragraph read as text: the engine applies the smallest word-level edits, so unchanged words keep their runs and formatting, and new words take the formatting of the run before them. A tab or a line break the paragraph has may be written as a space and stays; a \t or \n in text writes one. Symbols stay where they are and may be left out of text.

Fields

§paragraph: Selector

Paragraph to rewrite; must match exactly one.

§text: String

The paragraph’s new text, plain.

§comment: Option<String>

Comment on the rewritten paragraph, blank is none.

§

ReplyComment

Reply to comment comment_id, as the plan’s author; the reply is anchored on the same range. Word threads are one level deep, so a reply to a reply joins the thread’s first comment.

Fields

§comment_id: u32

w:id of the comment replied to (jubarte comments lists them): a number, or "c27".

§text: String

Reply text; \n starts a new line.

§

ResolveComment

Resolve comment comment_id and its replies (done: false opens them again).

Fields

§comment_id: u32

w:id of the comment: a number, or "c27".

§done: bool

Resolved (default) or open.

§

EditComment

Replace the text of comment comment_id; its id, author, date and thread stay.

Fields

§comment_id: u32

w:id of the comment: a number, or "c27".

§text: String

New text; \n starts a new line.

§

DeleteComment

Remove comment comment_id, its replies, their range markers and references.

Fields

§comment_id: u32

w:id of the comment: a number, or "c27".

§

Strike

Reject another author’s insertion visibly: our tracked deletion of its words, nested inside it, so Word shows it struck under our name and Reject of our change gives it back. Needs existing_revisions keep.

Fields

§revision: String

The insertion, as changes lists it (r366, header1.r3): every insertion mark of a change of several (r10+11), a replacement’s insertion only.

§comment: Option<String>

Comment on the struck words; blank is none.

§

Restore

Reject another author’s deletion visibly: their deletion stays, and our tracked insertion right after it holds a copy of its words, formatting included. Needs existing_revisions keep.

Fields

§revision: String

The deletion, as changes lists it (r12, header1.r3): every deletion mark of a change of several (r12+13), a replacement’s deletion only.

§comment: Option<String>

Comment on the restored words; blank is none.

§

InsertTable

Insert a table next to the anchor paragraph. Each cell holds one paragraph in the anchor’s paragraph style; the redline shows the rows inserted. Body paragraphs outside tables only.

Fields

§paragraph: Selector

Anchor paragraph; must match exactly one.

§position: Side

Which side of the anchor paragraph.

§rows: Vec<Vec<String>>

Cell text, row by row; every row has the same number of cells.

§header_row: bool

Mark the first row as a header row that repeats on each page.

§widths_dxa: Option<Vec<u32>>

Column widths in twentieths of a point; the text width split evenly when omitted.

§style: Option<String>

Table style, by id or name; TableGrid (added when the document lacks it) when omitted.

§

List

Make the paragraphs a list: each gets direct numbering at level, and ListParagraph when it has no style. The redline records each paragraph’s old properties (w:pPrChange).

Fields

§paragraphs: Vec<Selector>

Paragraphs to number, each selector matching exactly one; body only.

§kind_of_list: ListKind

Bullets, decimal numbers or lowercase letters.

§level: u32

List level, 0 (outermost) to 8.

§restart: bool

Start a new list (true), or continue the list of the nearest numbered paragraph before the first one, in that list’s format.

§

Watermark

Write Word’s own text watermark (Insert > Watermark) into every default header, creating a header where the first section has none. One per document. It is header content, not a tracked change: the clean copy and the redline both carry it.

Fields

§text: String

The watermark text, plain, 1 to 64 characters.

§color: Option<String>

Fill colour, six hex digits (default C0C0C0).

§diagonal: Option<bool>

Diagonal at 315 degrees (default); false lays it horizontal.

§font: Option<String>

Font family (default Calibri).

§

FillControl

Fill one content control (w:sdt) in the body with exactly one of text, choice, checked or date. The control keeps its properties; its content becomes the value.

Fields

§control: ControlSelector

The control: "p3.cc0" / "cc1", {"id"}, {"tag"} or {"alias"}; must match exactly one.

§text: Option<String>

Plain text, for text, rich-text and combo-box controls.

§choice: Option<String>

A list item’s value or display text, for drop-down and combo-box controls; the display text is written.

§checked: Option<bool>

Checkbox state.

§date: Option<String>

YYYY-MM-DD, for date controls; written in the control’s format.

§

FormatRun

Change the run formatting of one occurrence of existing text; the redline records the old formatting (w:rPrChange).

Fields

§paragraph: Selector

Paragraph to format; must match exactly one.

§find: String

Exact text to format.

§format: RunFormat

Formatting to set; fields not given stay as they are.

§occurrence: Option<usize>

Which occurrence of find (1-based) when it occurs more than once.

§

InsertFootnote

Insert a footnote whose reference mark follows one occurrence of after; the note goes in the footnotes part, created when absent.

Fields

§paragraph: Selector

Body paragraph to edit; must match exactly one.

§after: String

The reference mark goes right after this anchor text.

§text: String

Plain text of the note.

§occurrence: Option<usize>

Which occurrence of after (1-based) when it occurs more than once.

§

InsertImage

Insert a paragraph holding one inline picture next to the anchor paragraph. PNG, JPEG, GIF, BMP or TIFF.

Fields

§paragraph: Selector

Body paragraph the picture goes next to; must match exactly one.

§position: Side

Which side of the anchor paragraph.

§image_base64: String

The picture file, base64-encoded.

§content_type: Option<String>

The picture’s media type; checked against its bytes when given.

§width_emu: Option<u64>

Width in EMU (914400 per inch); the height keeps the aspect ratio. Default: the pixel size at 96 dpi, at most 6.5 inches.

§alt: Option<String>

Alternative text (wp:docPr descr).

§

PageSetup

Set the page size, orientation and margins of the last section or of every section; the redline records the old ones (w:sectPrChange). At least one of page, orientation, margins_dxa.

Fields

§section: SectionScope

last (default) or all.

§page: Option<PageSize>

letter, a4, or {"width_dxa", "height_dxa"}.

§orientation: Option<Orientation>

portrait or landscape.

§margins_dxa: Margins

Margins to change, in twentieths of a point.

§

InsertToc

Insert a table of contents next to the anchor paragraph: a TOC \o "1-{levels}" \h \z \u field, after an optional title paragraph styled TOCHeading. Its entries are written when the plan sets update_fields; otherwise the field is empty until Word updates it.

Fields

§paragraph: Selector

Paragraph to insert next to; must match exactly one, in the body.

§position: Side

Which side of the anchor paragraph.

§levels: u8

Heading levels listed, 1 to 9 (default 3).

§title: Option<String>

Title paragraph above the TOC ("Contents").

§

Redact

Replace one occurrence of find with one full block (U+2588) per character, untracked: the clean copy and the redline both show the blocks and neither keeps the text. The plan is refused with REDACTION_LEAK when the text still occurs anywhere in either output, and with REDACTION_INCOMPLETE when a part uses an encoding the scan does not certify. The report never repeats the text.

Fields

§paragraph: Selector

Paragraph to redact in; must match exactly one.

§find: String

Exact text to remove.

§occurrence: Option<usize>

Which occurrence of find (1-based) when it occurs more than once.

§

Settings

Write document settings into word/settings.xml in schema order: Track Changes, update fields on open, editing restrictions. Settings are not revisions: the clean copy and the redline both carry them. One per plan; a setting left out stays as it is.

Fields

§track_revisions: Option<bool>

Turn Track Changes on (w:trackRevisions) or off.

§update_fields: Option<bool>

Ask Word to update fields on open (w:updateFields), or not. The plan’s own update_fields writes jubarte’s results instead.

§protection: Option<Protection>

Restrict editing (w:documentProtection); edit: none lifts it.

Trait Implementations§

Source§

impl Clone for OperationKind

Source§

fn clone(&self) -> OperationKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OperationKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OperationKind

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<OperationKind, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for OperationKind

Source§

impl JsonSchema for OperationKind

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for OperationKind

Source§

fn eq(&self, other: &OperationKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OperationKind

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OperationKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.