Skip to content

Conversation

@mapo80
Copy link

@mapo80 mapo80 commented Nov 5, 2025

  • Extend < Image > metadata support in DocumentAssembler to honor Align, Width, Height, MaxWidth, and MaxHeight, preserving aspect ratios and mapping paragraph justification (w:jc) accordingly.
  • Parse CSS-like length units (px, pt, cm, mm, in, emu), apply both max constraints safely, and guard against invalid/zero values with contextual template errors.
  • Add resilience when SkiaSharp cannot decode a payload by falling back to PNG/JPEG/GIF header inspection to recover intrinsic dimensions, reducing failures on truncated or malformed data.
    Introduce helper utilities to compute unique image IDs, format justification values, and reuse paragraph extraction logic in tests.
  • Expand DocumentAssemblerTests with scenarios covering width/height scaling, combined max constraints, alignment variants, optional placeholders, invalid metadata, and truncated GIFs, achieving >90% coverage of the new logic.
  • Ship a new OpenXmlPowerToolsExamples/DocumentAssembler04 sample (template, sample data, SkiaSharp image generator) and rename DOCUMENT_ASSEMBLER.md to document image usage and metadata options.
  • Update .gitignore to exclude generated ExampleOutput* folders so sample runs stay clean.

Tests

  • dotnet test OpenXmlPowerTools.Tests/OpenXmlPowerTools.Tests.csproj -p:TargetFrameworks=net8.0 -nologo -clp:ErrorsOnly
  • dotnet build OpenXmlPowerToolsExamples/DocumentAssembler04/DocumentAssembler04.csproj -p:TargetFrameworks=net8.0 -nologo -clp:ErrorsOnly

dependabot bot and others added 21 commits November 5, 2025 11:39
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 4 to 5.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](actions/setup-dotnet@v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: System.Configuration.ConfigurationManager
  dependency-version: 9.0.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: SkiaSharp
  dependency-version: 3.119.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: SkiaSharp.NativeAssets.Linux.NoDependencies
  dependency-version: 3.119.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: SkiaSharp.NativeAssets.Linux.NoDependencies
  dependency-version: 3.119.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: SkiaSharp.NativeAssets.Linux.NoDependencies
  dependency-version: 3.119.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Upgraded several NuGet package versions in both OpenXmlPowerTools and test projects for improved compatibility and analyzer support. Added new PNG diff expectation files for various test cases to the TestFiles directory.
Migrated font metric logic from SixLabors.Fonts to SkiaSharp across the codebase for improved cross-platform compatibility. Added a new FontStyle enum, updated font family and style handling, and removed the SixLabors.Fonts dependency from the project file.
Upgraded DocumentFormat.OpenXml package to version 3.3.0. Updated PowerToolsBlockExtensionsTests to reflect new SDK behavior, where changes made through PowerTools are immediately visible to strongly-typed classes.
The GitHub Actions workflow for dotnet will no longer run on pull request events, only on push events. This simplifies workflow execution and may reduce unnecessary CI runs.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---
updated-dependencies:
- dependency-name: System.Configuration.ConfigurationManager
  dependency-version: 9.0.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: stesee <168659+stesee@users.noreply.github.com>
…icit sizing and alignment metadata (Align, Width, Height, MaxWidth, MaxHeight).

- Added robust dimension parsing (px/pt/cm/mm/in/emu), aspect-ratio preservation, and per-paragraph justification output.
- Introduced fallback decoders for PNG/JPEG/GIF headers when SkiaSharp cannot read an image, improving resilience to malformed data.
- Delivered extensive unit-test coverage for base64 errors, optional placeholders, width/height scaling, combined max constraints, alignment behaviors, and truncated image streams (over 90 % of new logic).
- Shipped a new DocumentAssembler04 sample that demonstrates multiple image alignments and resizing scenarios, plus refreshed documentation (DOCUMENT_ASSEMBLER.md).
@mapo80 mapo80 requested a review from stesee as a code owner November 5, 2025 17:33
@github-actions
Copy link

github-actions bot commented Nov 5, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 3 committers have signed the CLA.
✅ (mapo80)[https://github.com/mapo80]
❌ @Copilot
@politom-linksmt
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

}
catch
{
// ignore and fall back to header-based detection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can SkiaSharp ever fail to parse a valid image? If not, I recommend failing fast and returning an error here instead of trying to render invalid images — that keeps failures visible and avoids silent corruption.

@stesee stesee merged commit 833cf0b into Codeuctivity:main Nov 15, 2025
1 check failed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants