Profiles define what target environment Uniword generates DOCX output for. A Profile is the composition of three independent axes:
-
SystemProfile — What Word version to target (fonts, theme, compat settings)
-
LocaleProfile — What locale/language to use (lang tags, separators)
-
UserProfile — Who is creating this document (author metadata)
1. Quick Start
# Load a named preset
profile = Uniword::Docx::Profile.load(:word_2024_en)
# Apply profile when saving a document
doc = Uniword::Document.open("input.docx")
doc.save("output.docx", profile: profile)
2. Named Presets
Presets are defined in config/profiles.yml:
| Preset | System | Locale |
|---|---|---|
|
Office 2024+ |
en-US |
|
Office 2024+ |
zh-CN |
|
Office 2024+ |
ja |
|
Office 2024+ |
ko |
|
Office 2024+ |
de |
|
Office 2024+ |
fr |
|
Office 2016 |
en-US |
|
Office 2013 |
en-US |
|
Office 2010 |
en-US |
|
Office 2007 |
en-US |
|
Uniword (OFL fonts) |
en-US |
3. SystemProfile
The SystemProfile determines what Word version to target. Each profile specifies:
| Property | Description |
|---|---|
|
Compatibility mode value (12=2007, 14=2010, 15=2013+) |
|
Named font scheme from |
|
Named theme from |
|
Application string in |
|
Version string (e.g., |
|
OOXML namespace declarations to emit |
Available system profiles:
| Profile | Font Scheme | Theme | Compat Mode |
|---|---|---|---|
|
|
corporate |
15 |
|
|
corporate |
15 |
|
|
corporate |
15 |
|
|
workspace |
14 |
|
|
workspace |
12 |
|
|
meridian |
15 |
4. LocaleProfile
The LocaleProfile determines language-specific settings for DOCX generation:
| Property | Description |
|---|---|
|
Primary language tag (e.g., |
|
East Asian language tag (e.g., |
|
Bidirectional language tag (e.g., |
|
Decimal separator ( |
|
List separator ( |
# Load a specific locale
locale = Uniword::Docx::LocaleProfile.from_locale("ja")
locale.lang # => "ja"
locale.east_asia_lang # => "ja-JP"
locale.bidi_lang # => "ar-SA"
locale.decimal_symbol # => "."
locale.list_separator # => ","
# List all available locales
Uniword::Docx::LocaleProfile.available_locales
# => ["ar", "cs", "da", "de", "el", "en", ...]
Locale data is defined in config/locale_profiles.yml.
5. UserProfile
The UserProfile maps to Word’s UserInfo registry/plist entries:
user = Uniword::Docx::UserProfile.new(
name: "Ada Lovelace",
company: "Analytical Engine Co."
)
# These values populate docProps/core.xml and docProps/app.xml
profile = Uniword::Docx::Profile.load(:word_2024_en, user: user)
UserProfile fields:
| Field | Maps to |
|---|---|
|
|
|
|
|
Revision tracking author tags |
|
Envelope generation (not in OOXML directly) |
6. Custom Profiles
Create profiles programmatically:
# Compose from individual profiles
profile = Uniword::Docx::Profile.new(
system: Uniword::Docx::SystemProfile.load("office_2024"),
locale: Uniword::Docx::LocaleProfile.from_locale("ja"),
user: Uniword::Docx::UserProfile.new(name: "Taro Yamada")
)
# Delegate accessors
profile.lang # => "ja"
profile.compat_mode # => "15"
profile.user_name # => "Taro Yamada"
profile.body_font # => "Aptos"
profile.heading_font # => "Aptos Display"
7. Relationship to Reconciler
When a Profile is provided, the Reconciler uses it during serialization to populate DOCX parts with Word-expected content:
-
Settings — zoom, proofState, defaultTabStop, compat, mathPr, themeFontLang
-
Font table — profile-driven font entries with full metadata
-
Styles — docDefaults, latentStyles, default style definitions
-
Web settings — optimizeForBrowser, allowPNG, namespace declarations
-
App properties — Application, AppVersion, Template
-
Core properties — lastModifiedBy, revision, timestamps
-
Theme — loaded from profile’s default theme
Without a profile, only structural reconciliation runs (Group 1 and Group 3), preserving backward compatibility.