-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Use certer for vertical-align in Excel when meet vertical-align:middel in CSS #2195
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
Conversation
@@ -240,6 +240,10 @@ public function setVertical($pValue) | |||
$pValue = self::VERTICAL_BOTTOM; | |||
} | |||
|
|||
if ($pValue == 'middle') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if the method actually validated that the argument passed in was a valid entry from the possible values in the set of defined constants self::VERTICAL_*
rather than arbitrary case-sensitive values; providing the default VERTICAL_BOTTOM
if the value wasn't valid.
Likewise, it would also be good if a similar check was performed on setting horizontal alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find a function in Writer/Html, which is used to map vertical alignment in Excel to vertical-align
in CSS, but it maps both center
and justify
in Excel to middle
in CSS. Can i only map middle
to certer
and ignore justify
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution then should be in the mapping for the HTML Writer, providing a mechanism that allows the defined valign mapping VALIGN_ARR to be overridden with a custom mapping
This PR expands on PR PHPOffice#2195 from @nkjackzhang. That PR has been stalled for some time awaiting requested fixes. Those fixes are part of this PR, and additional tests and samples are added. The original request was to handle `vertical-align:middle` in Css (Excel uses `center`). This PR does its best to also handle vertical alignment Excel values not found in Css - `justify` (as `middle`) and `distributed` (as `middle`). It likewises handles valid Css values not found in Excel (`baseline`, `sub`, and `text-bottom` as `bottom`; `super` and `text-top` as `top`; `middle` as `center`). It also handles horizontal alignment Excel values not found in Css - `center-continuous` as `center` and `distributed` as `justify`; I couldn't think of a reasonable equivalent for `fill`, so it is ignored. The values assigned for vertical and horizontal alignment are now lower-cased (special handling required for `centerContinuous`).
Converting to draft. Change is superseded by PR #3048. If that change is merged, I will close this one. |
This PR expands on PR #2195 from @nkjackzhang. That PR has been stalled for some time awaiting requested fixes. Those fixes are part of this PR, and additional tests and samples are added. The original request was to handle `vertical-align:middle` in Css (Excel uses `center`). This PR does its best to also handle vertical alignment Excel values not found in Css - `justify` (as `middle`) and `distributed` (as `middle`). It likewises handles valid Css values not found in Excel (`baseline`, `sub`, and `text-bottom` as `bottom`; `super` and `text-top` as `top`; `middle` as `center`). It also handles horizontal alignment Excel values not found in Css - `center-continuous` as `center` and `distributed` as `justify`; I couldn't think of a reasonable equivalent for `fill`, so it is ignored. The values assigned for vertical and horizontal alignment are now lower-cased (special handling required for `centerContinuous`).
Superseded by 3048, which has just been merged. Closing this PR. |
…Excel
This is:
Checklist:
Why this change is needed?
When convert HTML to Excel, and meet
vertical-align: middle
fortd
element in CSS, we should not set "middle" tovertical
field inAlignment
, which doesn't work, instead, we should set "center" to it.