-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
[WordTextBox] Add additional features #188
[WordTextBox] Add additional features #188
Conversation
Updated WordTextBox constructors and methods to support an enumerated type for text wrapping options, replacing the boolean flag. Introduced WrapTextImage? property and adjusted internal behavior to use new text wrapping representation, enhancing the flexibility and readability of text wrapping logic in TextBox elements. Removed obsolete code paths that previously handled the boolean wrap logic.
Rework the handling of image wrapping in Word documents by removing the ineffective WrapTextImage enum handlers and consolidating the wrap logic within WordWrapTextImage utility class. This change streamlines the wrapping functionality, improves maintainability, and prepares for future extension. Removed redundant code blocks and corrected typo for WrapTextImage.InFrontOfText. The updated utility class now provides clearer abstraction and better separation of concerns, paving the way for implementing wrap setting functionality.
Updated the AddTextBox method to accept WrapTextImage enum, replacing the less descriptive boolean parameter for text wrapping. This change enables more robust text wrapping options and improves readability by explicitly stating the wrapping style in the method signature.
Introduced an optional parameter to specify the text wrapping style when adding text boxes. Default wrap style set to 'Square' to maintain backward compatibility and enhance layout flexibility without breaking existing implementations.
Fixed a typo in the enumeration used to specify image wrapping style in the document, changing `WrapTextImage.InFrontText` to the correct `WrapTextImage.InFrontOfText`. This ensures that images wrap as intended when placed over text.
Corrected the enum value for image text wrapping from `InFrontText` to `InFrontOfText`, ensuring consistency across image wrapping functionality tests and method calls. This change aligns the code with the correct terminology, improving code clarity and preventing potential misinterpretations that could arise from using an inaccurate enum value.
I've reworked your code a bit and removed boolean and instead created proper Wrapping functionality that is identical to the one in image. Anchor implements 90% of wrapping but we're missing Inline for both TextBox and Images. I've moved all the logic around wrapping to separate class, as I guess we will need to somehow expose other parameters of wrapping that are visible in WrapThrough and WrapTight and potentially in WrapTopBottom. I am not sure how to do this, as I'm too noobish on classes, but maybe I'll figure it out. This PR needs tests written before it can be commited + Add method in sections. |
- Updated the AddParagraphAfterSelf method to accept an optional parameter, allowing reuse of an existing paragraph for appending, thereby enhancing flexibility when manipulating document structures. - Introduced a new overload for AddParagraph in WordSection, enabling creation with a designated run flag for finer control over paragraph styling and rendering. - Included a new method for adding textboxes with specified text and wrapping style to enrich content formatting capabilities within document sections. - Adjusted AddHorizontalLine and AddHyperLink methods to explicitly pass an empty string to AddParagraph, ensuring consistent method behavior. These changes collectively improve the document modification API, offering users more control and ease when adding and customizing various document elements. The functionality could directly address feature requests or bug fixes, though references to specific issues are not provided.
Added an overloaded constructor to the WordTextBox class to allow creating a text box with an existing WordParagraph object. This enables better reuse of paragraph instances and facilitates more flexible text box creation workflows.
Modified the `AddTextBox` method to default the text wrapping to 'Square', streamlining the text box creation process by reducing the need to specify common wrapping styles manually. This enhancement aims to improve usability for cases where the 'Square' wrapping style is frequently used.
|
Awesome @PrzemyslawKlys! I've been in another project for over a week, but I'll come back to this one soon. Will try what you made and see where I may help. Thanks! |
Text box image wrapping now supports a `Drawing` object, enabling more precise wrap configuration. The `WrapText` property has been updated to utilize `Drawing`, ensuring better control over how text wraps around images. Additionally, two new methods, `ConvertInlineToAnchor` and `ConvertAnchorToInline`, have been introduced to facilitate conversion between inline and anchored text boxes, accommodating various text flow scenarios. This addresses layout customization needs for complex document structures.
|
Do you plan to create a new release with these changes? |
Sure, probably before Monday. I want to play with some other stuff. |
Something went terribly wrong with this PR, as even tho merge went in, it didn't went in with your or my changes? |
Ok i see it went into different branch |
You've built on top of different branch - here's new PR to master |
Sorry for the confusion! I forked your repo and create a branch for it, if I remember correctly. |
Not your fault. It was mine. I was just super scared i lost everything 😂 |
I feel you! 😂 |
This PR adds the following features:
Breaking change:
WrapTextImage.InFrontText
toWrapTextImage.InFrontOfText
to match Word naming