Skip to content

Improve watermark image #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft

Improve watermark image #255

wants to merge 23 commits into from

Conversation

PrzemyslawKlys
Copy link
Member

No description provided.

…mage1` method

* Un-commented logging statements to display watermark and image counts.
* Improved visibility of watermark properties during document creation and loading.
… watermark examples

* Introduced a new method to demonstrate various watermark functionalities.
* Supports adding text and image watermarks across multiple sections.
* Includes logging for initial and final watermark counts for better tracking.
* Added a null return statement to ensure consistent behavior.
* Enhanced `IsImage` property to check for both DrawingML and VML images in paragraphs.
…on retrieval

* Introduced `Type`, `IsHeader`, and `IsFooter` properties to determine the type of the instance.
* Added `Section` property to retrieve the associated `WordSection` for the Header or Footer.
- Enhanced `Watermarks` property to include watermarks from Default, First, and Even headers.
- Added aggregation of watermarks from Default, First, and Even footers.
- Note: Potential duplicates may occur if the same watermark exists in multiple header types.
…ooters

* Implemented logic to aggregate both text and image watermarks.
* Added checks to prevent duplicate image watermarks.
* Improved handling of `SdtBlock` elements for text watermarks.
…l handling

* Changed `_sdtBlock` visibility to internal for better access control.
* Enhanced null handling in the `_shape` property and watermark retrieval logic.
* Updated constructor to initialize `_document` with `Picture` parameter.
* Clarified that the `Images` property aggregates only DrawingML images.
* VML images, such as watermarks, are accessed via `WordParagraph.Picture`.
* Introduced a new method `FindImagePart` to streamline the process of locating the image part associated with the `WordImage`.
* Enhanced handling for image parts in headers and footers, improving robustness against missing IDs.
* Improved null handling for watermark counts in headers.
* Added detailed output for watermark counts across sections.
* Enabled different first page headers for sections with appropriate watermarks.
@PrzemyslawKlys PrzemyslawKlys marked this pull request as draft March 30, 2025 13:19
…ion tests

* Added assertions to verify the number of images in the document after adding images in tests.
* Ensures that the image count is correctly tracked during document creation.
…ation test

* Changed assertion from `Assert.Equal(1, document.Images.Count)` to `Assert.Single(document.Images)` for clarity and consistency.
…andling

* Updated `GetGraphic` method to include `description` parameter.
* Enhanced `FindImagePart` method to handle `ArgumentOutOfRangeException` more gracefully.
* Added comments for clarity on the image part search process in headers and footers.
* Updated the `IsImage` property to check for the presence of `Image` directly.
* Removed legacy checks for `Drawing` and VML `Picture` elements for clarity and maintainability.
* Cleaned up unnecessary `using` statements to improve code readability and maintainability.
* Updated the color of the default text watermark in Section 0 to improve visibility.
* Implemented `Test_AddRemoveMultipleWatermarks` to verify the functionality of adding and removing both text and image watermarks across different sections.
* Ensured assertions check the correct count and properties of watermarks after each operation.
* Validated the persistence of watermark states after saving and reloading the document.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant