# SmartScribe.Docx SDK

**The DOCX engine powering SmartScribe Pro — now available to developers.**

A native C++ DOCX SDK with correct ECMA-376 spec compliance. Usable from C, Python,
.NET, Rust, Java, and any language with a C FFI.

## What makes it different

Most DOCX libraries get the six-layer style cascade wrong, mishandle toggle property
XOR behavior (bold/italic), and mangle the four-slot rFonts model — producing documents
that look different in Word than they should. SmartScribe.Docx implements ECMA-376
correctly, battle-tested in SmartScribe Pro against real manuscripts.

## API surface (v1.1.0)

Pure C linkage. 28 functions covering:

- Open / create / save DOCX files
- Read and write document body via HTML
- Margins (all eight values including gutter and mirror margins)
- Headers and footers (default, even, first-page variants)
- H/F XML builder with {PAGE} {NUMPAGES} {TITLE} {CHAPTER} {AUTHOR} variables
- Document properties (title, author, subject, description)
- Section flags (titlePage, evenAndOdd)
- Page number format and start value

## Quick start

### C
```c
#include "SmartScribeDocx.h"

ssDocx_init();
SsDocxHandle h = ssDocx_open("input.docx");
ssDocx_set_margins(h, 1440, 1440, 1440, 1440, 709, 709, 0, 0);
ssDocx_save(h);
ssDocx_close(h);
```

### Python
```python
from smartscribe_docx import SmartScribeDocx

doc = SmartScribeDocx("input.docx")
doc.set_margins(top=1440, bottom=1440, left=1440, right=1440)
doc.save()
doc.close()
```

### C# / .NET
```csharp
using var doc = SmartScribeDocx.Open("input.docx");
doc.SetMargins(top: 1440, bottom: 1440, left: 1440, right: 1440);
doc.Save();
```

## Building from source

Requires Qt 6.2+ (MSVC x64 on Windows, GCC/Clang on Linux/macOS).

```bash
cmake -B build -DCMAKE_PREFIX_PATH="C:/Qt/6.10.2/msvc2022_64"
cmake --build build
```

Or use the Miniz backend to reduce Qt dependency surface:

```bash
cmake -B build -DSMARTSCRIBE_ZIP_BACKEND=Miniz -DCMAKE_PREFIX_PATH="..."
```

## Pre-built binaries

`prebuilt/win-x64/` contains SmartScribeDocx.dll and SmartScribeDocx.lib
built against Qt 6.10.2 / MSVC 2022 x64.

## License

Commercial license required for production use.
See LICENSE.txt for terms.
