Set fixed size for Text block SwiftUI - text

I have cell model, and sometimes I have long text in title and cell's size changes. Do you know how to fix text position and align it by first line?

It looks like you are wrapping the cells with HStack. Use HStack(alignmeht: .top)

Related

How to re-size a text area depending of the text size?

I wanna know an ideal way to re-size a text area depending of the text size like various programs do.
In my case we will asume the width, font and font size are constant, and I'm not using line breaks, so it would be something like doing this:
I know I should consider the words, their length, every " " character, and how many are per line, I wanna know a not messy way to achieve this

Wrap Text in openPD

Is there a way to wrap text around an image in openPDF? or around other text? I'm trying to mesh two texts onto one page (texts which may contain pictures), but one text may be larger or smaller then the other. They could look like one of these two pictures:
I was going to make a column text, and test the length of text 2 against the length of the text of text 1 that remains after the first few lines (see the picture), but I couldn't return the remaining text with columnText.go(true).
Is there an easy way to wrap text around a picture or other variable object (aka text)?

Adding object to paragraph style in InDesign

I am trying to add a short underline in the paragraph style for my inline headlines. At the moment I am doing it with Paragraph Rules - rule below + offset and right indent (see attached image, the orange line). But this solution only works if the columns are always the same width.
Is there a way to add a object/line, with a defined width, to a paragraph style?
Spontaneously, would say no. However that would be easy to set while adding some contents. You could however use a dedicated character style (underline) taht you would attach with agrep style to a tab character. Then you can control "rule" width with a tab position.
Sure. Here it is…(and now just adding characters so stackoverflow will accept my if not too brief message…)
The fact is that you need to add a new line and type in a tab character. The presence of that tab will draw the "rule".
Other solution is to use both "Above" and "Below" rules.
Playing with below's weight, color (white), offset and left indent would make it independent on column width (ruleAbove has entire column range)
Here is how I would solve it:
Create a Stroke Style with Pattern Length = to the page size of your document (not text frame or column) and Length = to whatever length of your line should be.
Example:
Pattern Length = 8.5in (letter size paper)
Length = 1in (width of line under paragraph)
Use Rule Under in the paragraph style and apply the stroke style you created. Make sure to set Width to "Text".
Apply any color/offset, etc. options.
This will work independently of the text column width and text length.

How to tell if ultragrid text has been truncated

We are using infragistics ultragrid to present data to the user. if the user modifies the width of a column, I need to be able to tell if the data is truncated so that I can adjust the output properly when exporting the data into pdf. We want to truncate the data when exporting to other formats to match what the user sees after the column width adjustment.
Thanks,
Currie
Whether the text is cut off or not is done automatically when drawing the string so you would need to get the available space and the string and then determine how much of it fits into the space when drawn.
Within the CellExporting event of the UltraDocumentExporter, you can get the text and the size with the following:
Size size = e.GridRow.GetCellSizeResolved(e.GridColumn);
string text = e.GridRow.GetCellText(e.GridColumn);
You can also change the value that is being exported by setting e.ExportValue to the string that you want to put in the PDF document.
What remains to be done is to determine the amount of characters that fit into the rectangle and the following should help you with that:
How to determine maximum number of characters given a fixed width font and a maximum width in pixels

force breaking a string in a fixed width Gridview cell

I have a Gridview control on an ASP.Net page with fixed width cells. The data coming from the database occasionally comes over as a contiguous string of characters. When there are dashes in the string, it will break so as not to upset the width of the layout. If there are no dashes (specifically, I'm dealing with underscores), the string will not break and forces the cell to widen out, thus upsetting the layout of the page. Is there a way to tell the cell to keep its width and break the string? As it stands, I don't have access to the field's data directly, as the GridView bind its datasource to a dataset object coming from the database. Thanks for any feedback.
If you handle the RowDataBound event you'll be able to break the string "manually". Otherwise it'll only break based on "HTML rules".
First thing to note is that this doesn't have a lot to do with ASP.NET but is rather a pure HTML (and CSS) problem.
A possible solution is to use the css attribute table-layout: fixed and set some fixed width values to all columns. The disadvantage of this approach is that the total table width is fixed so it doesn't scale with the window size.
Another possible approach is to display in columns shorter strings using a utility function that cuts the long strings to a maximum length.

Resources