Skip to content

Commit 0b9f7e2

Browse files
authored
docs: add release notes for v2.2.1 (#9)
1 parent 20a79f8 commit 0b9f7e2

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

RELEASE_NOTES_v2.2.1.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Release Notes - v2.2.1
2+
3+
**Release Date:** January 2026
4+
5+
## Bug Fixes
6+
7+
This release fixes critical DOCX validation errors that prevented documents from opening in Microsoft Word after round-trip operations (read → modify → save).
8+
9+
### Fixed
10+
11+
- **Hyperlink RelationshipID Preservation** ([#6](https://github.com/mmonterroca/docxgo/issues/6))
12+
- When reading and re-saving documents with hyperlinks, the library was generating new relationship IDs instead of preserving the originals
13+
- This caused Word to fail with "relationship not found" errors
14+
- Now correctly preserves original `rId` references during round-trip
15+
16+
- **Drawing Position Serialization**
17+
- Fixed `wp:align` empty value error for floating images
18+
- Images with `posOffset=0` were incorrectly serialized with empty `<wp:align>` elements
19+
- Added `UseOffsetX`/`UseOffsetY` flags to `ImagePosition` to distinguish between "offset = 0" and "no offset set"
20+
21+
- **Internal Hyperlink Anchors**
22+
- Added support for anchor-based internal hyperlinks (bookmarks, TOC links)
23+
- Serializer now correctly handles both `anchor` property and URLs starting with `#`
24+
25+
- **Custom Styles Preservation**
26+
- Documents with custom styles (modified Heading1, custom BodyCopy, etc.) are now preserved correctly during round-trip
27+
- All 55+ custom styles from templates are maintained
28+
29+
## New Features
30+
31+
### Troubleshooting Documentation
32+
33+
Added comprehensive troubleshooting guide for DOCX validation errors:
34+
- `docs/TROUBLESHOOTING_DOCX_VALIDATION.md`
35+
- Includes diagnostic workflow, common errors, and solutions
36+
37+
## Installation
38+
39+
```bash
40+
go get github.com/mmonterroca/docxgo/v2@v2.2.1
41+
```
42+
43+
## Usage Example
44+
45+
```go
46+
// Read existing document with custom styles
47+
doc, err := docx.OpenDocument("template.docx")
48+
if err != nil {
49+
log.Fatal(err)
50+
}
51+
52+
// Modify content - styles are preserved
53+
para := doc.AddParagraph()
54+
para.AddRun().SetText("New content")
55+
56+
// Save - document opens correctly in Word
57+
if err := doc.SaveAs("output.docx"); err != nil {
58+
log.Fatal(err)
59+
}
60+
```
61+
62+
## Known Limitations
63+
64+
When loading an existing document and adding **new** images or hyperlinks (not modifying existing ones), the new relationships may not be written correctly. This is tracked in [#8](https://github.com/mmonterroca/docxgo/issues/8).
65+
66+
For the primary use case of reading a template, modifying text, and saving, this version works correctly.
67+
68+
## Acknowledgements
69+
70+
Thanks to [@krishnadubagunta](https://github.com/krishnadubagunta) for reporting the issue with detailed examples that helped identify the root cause.
71+
72+
## Files Changed
73+
74+
- `domain/image.go` - Added `UseOffsetX`/`UseOffsetY` flags
75+
- `internal/core/run.go` - Preserve existing relationshipID
76+
- `internal/core/document.go` - Store preserved parts for round-trip
77+
- `internal/reader/reconstruct.go` - Preserve original parts and set UseOffset flags
78+
- `internal/serializer/serializer.go` - Handle anchor hyperlinks, use preserved relationshipID
79+
- `internal/writer/zip.go` - Write preserved parts during round-trip
80+
- `internal/xml/drawing_helper.go` - Use offset flags in serialization
81+
- `internal/xml/paragraph.go` - Add Anchor/History to Hyperlink struct
82+
83+
## Full Changelog
84+
85+
See [PR #7](https://github.com/mmonterroca/docxgo/pull/7) for complete details.

0 commit comments

Comments
 (0)