Skip to content
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

RTL Text Alignment in Xlsx Comment #4006

Merged
merged 2 commits into from May 5, 2024
Merged

Conversation

oleibman
Copy link
Collaborator

@oleibman oleibman commented May 1, 2024

Fix #4004. RTL text can be included in a comment, and will display correctly, but the comment as a whole will be left-aligned. There already exists an alignment property for Comment, but it is unused. This PR will allow that property to be set, and to be read from and written to an Xlsx spreadsheet when possible.

The Xml tags that govern this property are found, unusually, in a drawing Vml file. The important property is x:TextHAlign, which can be set to Left, Right, Center, Justified, or Distributed. There are other tags which seemed like they were relevant to this problem, but I don't think they actually matter:

  <v:textbox style='mso-direction-alt:auto'>
   <div style='text-align:right;direction:rtl'></div>
  </v:textbox>

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

Fix PHPOffice#4004. RTL text can be included in a comment, and will display correctly, but the comment as a whole will be left-aligned. There already exists an `alignment` property for Comment, but it is unused. This PR will allow that property to be set, and to be read from and written to an Xlsx spreadsheet when possible.

The Xml tags that govern this property are found, unusually, in a drawing Vml file. The important property is `x:TextHAlign`, which can be set to Left, Right, Center, Justified, or Distributed. There are other tags which seemed like they were relevant to this problem, but I don't think they actually matter:
```xml
  <v:textbox style='mso-direction-alt:auto'>
   <div style='text-align:right;direction:rtl'></div>
  </v:textbox>
```
@oleibman oleibman enabled auto-merge May 5, 2024 11:17
@oleibman oleibman added this pull request to the merge queue May 5, 2024
Merged via the queue into PHPOffice:master with commit c56a583 May 5, 2024
13 of 14 checks passed
@berberon
Copy link

berberon commented May 5, 2024

Hi

Thanks for taking care of this.
When will i be able to use compuser to DL this change?

@oleibman oleibman deleted the issue4004 branch May 5, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants