Difference between center and centercontinuous alignment in ClosedXML? - asp.net-mvc

I am working on ClosedXML for Export an Excel, and just find a property for alignment Center and CenterContinuous.
worksheet.Column(9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
And
worksheet.Column(9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.CenterContinuous;
I have tried both, but the results remain same, anybody know what the exact difference?

CenterContinuous will center text along cells with same style.

Related

How to align two UILabels on the Y axis of the center of the first line of text

please see the image below for two examples of what is to be achived
the alignment should be on the Center Y of the first lines of each UILabels and should work regardless of font size or font. currently we have implemented this with different constraints to the top of the super view for different font and font size combinations.
the constraint to align the center of the two UILabels does not work since the text of the second UILabel is not fixed and can have several lines.
also the text is dynamic, so it is not known where the text will wrap to create the first line, thus it cannot be shown in an one line UILabel with the rest of the text in another one below.
currently this is implemented using UIKit, but if there is an easy solution in SwiftUI we can put these two labels in a SwiftUI component. so a SwiftUI solution would also be welcomed.
Your comments said "it should be on the glyphs" ... but, without additional information, my guess is that "real world" usage would not really need that level of precision.
For example:
While the glyphs are not perfectly center-Y aligned, it seems unlikely you'd run into a case where the first line of the "rightLabel" is " ' " ' " or . , . , ..
This layout can be easily done with only a few constraints - no need to do any calculations:
The "Positioning" label would, of course, be set .hidden = true so it would never be seen.
If you really, really want glyph-precision, you'll need to calculate
the Glyph bounding box for the left-label
the Glyph bounding box for first line of the right-label
calculate the "character box" offsets to align the Glyph Y-centers
and then position the two labels accordingly, or use Core Text to draw the text (instead of using UILabel).
Probably more work than necessary -- unless your actual use-case demands it.
That's an interesting problem! You can try using the centerYAnchor for the label on the left, and the firstBaselineAnchor for the label on the right... that will align the center Y with the text baseline, which isn't quite what you want.
To find the correct offset to apply, you can use the information from UIFont about the size of the characters. I'd probably start with capHeight * 0.5 and see if that looks or feels right. Something like:
leftLabel.centerYAnchor.constraint(equalTo: rightLabel.firstBaseLineAnchor, constant: rightFont.capHeight * 0.5)
This is a more difficult problem in SwiftUI, I think, because resolved font metrics aren't directly available to you.

Not getting exact Text box Bounds using PSD.rb gem

I'm trying to parse the PSD file using PSD.rb gem.
When I'm trying to get the text box bounds, it is giving minimal bounding box for the text, not the actual text rectangle dimensions in the psd file.
Similar issue was posted here: https://github.com/layervault/psd.rb/issues/78
But, there is no proper solution for it. So, can anybody help me in finding the exact text box Bounds from PSD?
Thanks in advance!
Getting Height & Width information from the bounds object:
bounds = layer.adjustments[:type].data[:text]["bounds"]
layer_tree = layer.to_hash
transform = layer_tree[:text][:transform]
top = transform[:ty] + bounds["Top "][:value]
left = transform[:tx]
width = bounds["Rght"][:value]
height = bounds["Btom"][:value] - bounds["Top "][:value]
Thanks.

Changing text adjustment in UIView using swift

I've been trying to create my app and something is bugging me very much,
I have images of what I am trying to achieve:
1)
2 )
number 1 shows what I am trying to do, the letters are "squeezed" together making the text appear tighter with a short width even though the letter sizing is big.
number 2 shows my attempt to achieve this, I tried multiple different ways to get that same look but failed for hours, does anyone have any suggestions or know how to make the text look like that in the first picture?
I appreciate any help, thank you!
The only way how to do it AFAIK is to use transform on UILabel, like this:
let widthTransform = 0.8 // Shrink label to 80% of its width
label.layer.transform = CATransform3DMakeScale(widthTransform, 1.0, 1.0);
Hope it helps!
Note* that transform work for about 30% of decrease (even less imo), then it just starts to look very bad. You can also change text spacing, but if you calculate it dynamically, you could end up with negative one and that looks terrible. The easiest way really is then just change of the design :)
Options:
You can decrease character spacing like in this answer
and increase font size.
Having fun with transformation on layer is really awful idea, as later you won't be able to get the height of text etc -> just everything will be working wrong.
You can also just use different font.

iOS-PDF highlight getting drawn on wrong position

I am using PDFKitten code. I have fixed all the issues regarding parsing of CMap, /Differences in that.
I have a pdf with TrueType and Type1 fonts.
I have parsed its differences and widths array.
However whenever I try to select or search text highlight is shown on the wrong position. What can be the problem?
I have applied MediaBox transform to drawing rect. It worked for some other pdfs but its not working for this. What more I have to do to solve this problem?
I have checked link for similar issue but solution is not working.
Thanks.
Adding the screenshot :
It turns out the glyph for particular unicode was not identified correctly. It is the bug in PDFKitten.
Resolved it by adding Glyph model by keeping it's width.
While calculating width instead of Mapping back to glyph I use glyph from model to get the width from the font.

howto draw a text with alignment centered in simpliest way. (ios , swift)

I would like to draw a text in my custom view at point X,Y with center allignment. In case the text would be "SUGUS", I expect to have the Character G at Point X,Y.
I tried several things with NSString.drawinRect(), where I have to provide the width of the text, which has to be measured first depending on the Fonttype. It worked, but for me thats not a straightforward solution.
I purposely did not add code here, because a first try with code was misleading and I hope someone can help me with a clean simple solution ?

Resources