How to Add Chapters to PDF

UniOffice v2.0 is now available, and it’s more than just a visual update. This version comes with better error-checking, smarter formatting tools, and important fixes for bugs, making it easier and smoother to work with Office files.

Why Upgrade?

This isn’t just another minor update; it’s a serious upgrade in functionality, performance, and reliability. Whether you’re working with Word documents, spreadsheets, or PowerPoint files, UniOffice v. 2.0 delivers a smoother, more accurate experience.

Let’s take a closer look at what’s new.

Breaking Changes: Adjust or Get Left Behind

Choice Elements Are Now Strictly Validated

Previously, some choice elements weren’t handled. Now, UniOffice follows the Office Open XML (OOXML) XSD schema to the letter. What does this mean for you?

  • Stricter validation: No more rogue elements slipping through.

  • New access patterns: choice elements are accessed through specific choice containers.

  • Better type safety: Cleaner, more reliable code.

Code Impact Example:

blockLevelElts := d.X().Body.EG_BlockLevelElts
for _, ble := range blockLevelElts {
    content := ble.BlockLevelEltsChoice.EG_ContentBlockContent
    // Work with content
}

If you’re not following this structure, we strongly recommend refactoring to ensure better organization, maintainability, and overall efficiency.

Obsolete Functions Got the Axe

These functions have been gathering dust and are now officially gone:

  • SetLegacyLicenseKey

  • SharedStingsType

  • SharedStingsTypeStrict

Function Renaming: Out With the Old, In With the Clear

  • AddFileFromDiskAddFileFromStorage

  • DiskPathStoragePath

These renames had been sitting in the codebase since 2020 as TODOs. Better late than never!

New Features: Fresh, Functional, Fantastic

HTML Text Support: Formatting Just Got Easier

Instead of manually tweaking text formatting with multiple function calls, you can now inject HTML directly:

para := doc.AddParagraph()
run := para.AddRun()
run.AddHTML("<b>Bold Text</b> and <i>Italic Text</i>")

Supported HTML tags: <b>, <strong>, <i>, <em>, <u>, <mark>, <sub>, <sup>.

This is a game-changer for nested formatting—no more clunky workarounds!

Commenting is Here

You can now add comments to documents that show up in MS Word. Collaboration just got a whole lot smoother.

Improvements: Making a Good Thing Even Better

Watermark Customization: Because Details Matter

Text watermarks are now fully customizable:

  • SetFontFamily(): Pick your font.

  • SetFontSize(): Adjust for visibility.

  • SetColor(): Match your branding.

  • SetDiagonalLayout(): Change the watermark angle.

  • SetOpacity(): Control transparency.

Now, your watermarks can look exactly how you want them to.

Default PDF Page Size: No More Surprises

Set default page sizes for converting documents, presentations, and spreadsheets to PDFs. Supports:

  • Letter

  • A4

  • A3

  • A5

  • Legal

Custom sizing is also available for special cases.

Improved PPTX-to-PDF Conversion

  • Tables and borders convert more accurately.

  • Luminance offset is processed correctly.

Smarter Word-to-PDF Conversion

  • Text highlighting now carries over correctly.

  • Auto-border colors get defined widths and shades.

Bug Fixes: The Cleanup Crew Arrives

What’s Fixed?

BugWhat Changed?
Table Background ColorsFixed for PowerPoint-to-PDF conversion.
CustomXML ItemsSaved correctly in presentations.
Tint AlgorithmPowerPoint PDFs now display colors properly.
Path HandlingPrevents issues when decoding relationships.
Table Width & AlignmentNo more misplaced tables in PDFs.
Repeating Table HeadersHeaders now appear correctly across pages.
Table Cell PatternsConverted to shading in PDFs.
Fix for CustomXML ItemsEnsures customXML files are preserved.
Border Width & Auto-Color FixProperly sets borders in Word-to-PDF conversion.
Fix for Luminance OffsetEnsures correct color processing in PDFs.

Detailed Bug Fix Explanations:

Table Background Colors

Previously, when converting PowerPoint presentations to PDFs, table background colors were not preserved correctly. This fix ensures that the background colors of tables remain accurate in the final output.

CustomXML Items

A bug prevented customXML items from being saved correctly when working with presentations. Now, these items are stored properly, ensuring all document metadata and settings are retained.

Tint Algorithm in PowerPoint PDFs

The tint algorithm for PowerPoint-to-PDF conversions was not processing color shades properly. This has been corrected, leading to more accurate color representation in converted files.

Path Handling for Relationships

Some presentations had issues opening in PowerPoint due to incorrect relationship paths when decoded. This fix ensures proper handling of paths, preventing file corruption.

Table Width & Alignment Fix

Tables in documents sometimes appeared misaligned when converted to PDFs. Now, they retain their original width and alignment, ensuring consistent formatting.

Repeating Table Headers in PDFs

When converting long tables that spanned multiple pages, headers did not always repeat correctly. This update ensures table headers appear as expected on each page.

Table Cell Background Patterns

PowerPoint tables that used patterned backgrounds were not displaying correctly in PDFs. This issue has been resolved by converting these patterns into shading effects that maintain document readability.

Fix for Creating CustomXML Items

Office documents containing customXML files were losing their metadata upon saving. This fix ensures that such files are preserved correctly after being processed by UniOffice.

Border Width & Auto-Color Fix

Borders set to auto-color in Word documents were not being properly defined in PDF conversions. This fix ensures that such borders now have a clear width and color assignment.

Fix for Luminance Offset

Some color processing issues arose when converting Office documents to PDFs due to incorrect luminance offsets. This fix corrects those problems, improving overall color accuracy.

Final Thoughts:

UniOffice v2.0 is designed to make your work with Office files easier and more reliable. This update fixes past issues, improves error-checking, and brings new features like better document conversion and easier text formatting. Whether you’re updating a document, creating a presentation, or converting files to PDF, UniOffice v2.0 offers a smoother and more user-friendly experience.

Upgrade now to enjoy a library that keeps your work simple, efficient, and error-free.