WolfDocx documentation - Commercial

# Handle WolfDocx reports, refusals, and command-line requests

Check report.passed before using a WolfDocx operation as a successful result. Community exposes separate edit and save reports, and a refused operation carries a code explaining its boundary. The command-line examples here target Commercial; do not assume installing Community also installs every Commercial command or capability.

## Inspect a Community refusal

The following Python targets the public `wolfdocx` Community 0.1.0 package on Python 3.11 or newer. Install it with `pip install wolfdocx`, provide an existing `input.docx`, and run the script. It prints the edit outcome and deliberately does not publish a file.

```
import json
from wolfdocx import Document

with Document("input.docx") as doc:
    report = doc.find_replace("UNLIKELY_MARKER_48291", "replacement")
    print(json.dumps(report.to_dict(), indent=2))
    if not report.passed:
        print("Not applied:", report.code)
    else:
        print("Applied in this session; no file saved.")
    print("Changed parts:", doc.changed_parts)
```

If the marker does not occur, the code is `find_replace_no_match`, `passed` is false, and this operation leaves the session unchanged. If your input happens to contain the marker, the operation can apply instead. The example checks the outcome rather than pretending a particular business document is guaranteed to have no match.

A refusal is not always an exception. Operation reports express supported and refused document transformations, while invalid arguments or a file that cannot be opened may also raise an exception. Handle the API's documented result and ordinary Python failures at their actual boundary; do not catch every exception and label it a successful no-op.

## Keep editing and saving distinct

| Value | What to check |
| --- | --- |
| `passed` | The operation-specific success predicate. |
| `status` | The reported lifecycle state, not a universal success string. |
| `code` | The refusal reason when the operation did not pass. |
| `to_dict()` | The structured receipt for logging or application handling. |

Community's find-and-replace report uses an applied state after an accepted edit. A successful `Document.save` receipt uses a published state. Check each report's `passed` property rather than writing one string comparison that assumes every API has the same lifecycle.

The save receipt includes the source digest, destination, changed parts, and other publication details. It is evidence about the package operation, not a screenshot comparison. In particular, a structural save does not establish Word-identical pagination or evaluate every cached field result.

When chaining operations, remember that an earlier accepted edit can remain in the session even if a later edit refuses. Decide intentionally whether to discard the session or save those earlier changes. The editing guide exits before save when either of its required changes fails.

## Commercial command-line discovery

The CLI example below targets the authenticated Commercial installation of `wolfdocx`. Use its checkout-success credential with the product index, in an environment separate from Community. Both editions install under the same name from different indexes; an environment holds one or the other.

```
python -m pip install wolfdocx --index-url https://packages.wolfxl.com/wolfdocx/simple/
```

With Commercial installed and `handbook.docx` present, this bash or zsh command inventories fields without changing the package. The command emits structured JSON and reports failure through its process result as well as the payload. Inspect both in an automated pipeline.

```
wolfdocx author fields-targets handbook.docx
```

Discovery does not render pages or refresh a cache. To publish a refresh, use the separate `wolfdocx author fields-refresh request.json` command with the complete source-bound JSON request described in the fields guide. Do not feed discovery output back as an unmodified request: the operation schema also needs output and font choices.

## What it does not do

- A successful inventory does not guarantee a later edit will pass.
- A refusal does not authorize deleting existing output or weakening target guards.
- Community is not promised the Commercial CLI shown here.
- A package receipt does not certify visual equivalence to Microsoft Word.

## Related documentation

See [edit and save handling](https://wolfdocx.com/docs/editing-text-and-tables), [Commercial field requests](https://wolfdocx.com/docs/fields-and-toc), and the [Commercial source-backed API reference](https://wolfdocx.com/api-reference).

## Get WolfDocx

WolfDocx Community is MIT-licensed and free, including commercial use. It edits existing .docx files in place in pure Python and does not render pages or convert to PDF. WolfDocx Commercial does not change those rights.

```
pip install wolfdocx
```

WolfDocx Commercial is an organization-scoped subscription. WolfDocx Community installs from public PyPI with pip install wolfdocx. WolfDocx Commercial installs from the authenticated WolfDocx package index with a per-purchase credential, issued on the checkout success page after payment and reissued through https://wolfxl.com/recover.

Review the scoped before-and-after memo files in the [reporting walkthrough](https://wolfsdk.com/blog/updating-existing-office-reporting-files), or [ask about your document](mailto:trial@wolfxl.com?subject=WolfDocx%20workflow%20fit) before purchasing if compatibility is uncertain.

[See WolfDocx Commercial](https://wolfdocx.com/)

### Related tasks

- [Update table cells in an existing Word document with Python](https://wolfdocx.com/update-docx-table-python)
- [Replace text in an existing Word document with Python](https://wolfdocx.com/replace-text-docx-python)
- [Fill a Word template table with rows from Python](https://wolfdocx.com/fill-word-template-python)
- [Word mail merge in Python: fill MERGEFIELD templates and repeating table rows](https://wolfdocx.com/mail-merge-docx-python)
- [Merge Word documents in Python without breaking numbering, headers, or styles](https://wolfdocx.com/merge-docx-python)
- [Update a Word table of contents in Python without opening Word](https://wolfdocx.com/update-toc-docx-python)
- [Convert DOCX to PDF in Python without Word or LibreOffice](https://wolfdocx.com/convert-docx-to-pdf-python)
- [A python-docx alternative for editing existing Word documents](https://wolfdocx.com/python-docx-alternative)
- [How can Python generate many legal contracts from one Word template?](https://wolfdocx.com/generate-contracts-docx-python)
- [Which Python workflow assembles one Word document from clauses and sections?](https://wolfdocx.com/document-assembly-python)
- [How do you prevent Word's unreadable content warning after a python-docx save?](https://wolfdocx.com/python-docx-unreadable-content)
- [Why does python-docx change Link to Previous on headers and footers?](https://wolfdocx.com/python-docx-header-footer-link-to-previous)
- [Can python-docx handle nested tables and complex headers?](https://wolfdocx.com/nested-tables-docx-python)
