iTextSharp 7 wrapping and no wrapping - itext

Is it possible to manage wrapping of text?
I have a long string, longer than a cell, in a paragraph. If it is in form "ABCDEFGHIJKLMN", will be displayed on a line (row) of text. But if it is in "ABC DEFGH IJKLM" form, it is wrapped in two lines. How could be forced to stay on one line?

In a comment the OP clarified
I would like the cell to expand. Anyway, the no wrapping idea comes out of many pages on the Internet saying it wouldn't wrap if no wrapping spaces are used. I don't know if it did, it doesn't do this anymore ...
The iText 7 Table with its default TableRenderer renderer class only supports fixed column widths which can be given by
a fixed table width and a single integer, the number of columns,
a fixed table width and an array of relative column widths, or
an array of absolute column widths.
Thus, what those many pages on the Internet say, does not seem possible.
That been said, the iText 7 architecture allows to set a custom next renderer. Thus, it might be possible to introduce a certain amount of dynamic behavior, in particular some automatic cell resizing, if you implement a table renderer to do so.
Such a custom renderer is likely to run into problems, though, whenever code makes use of the ILargeElement interface Table implements because then the first cells will have to be layout'ed before all cell contents are known.

Related

Adding a header to a listbox

I want to know if it's possible to make first two lines (Titles and horizontal line in the image below) always show on top and to be unclickable, to make them something like a header of the current listbox.
I think that your approach is not feasible since this is just not how listboxes work (i.e. it's not a spreadsheet where you fix the top rows). Having said that, you might be able to create something that looks like what you're suggesting, by creating two listboxes one below the other, making the top one read-only or non-interactable (or better yet, make the top one a static text label or a text area).
Another thing I'd like to comment about is the structure of your listbox. In terms of UX, it's uncommon for a user to choose two things at the same time. So even if this makes sense in your context, I would advise to split it into two lists, and have them change each other within callbacks.

Setting different Cell-Formats in a Matlab uitable

I am looking for a way to handle different type of data in one column of a Matlab uitable.
Usually uitable is used to set whole columns to the same data type, such as logical (gives a checkboxes), char (gives left-aligned text), numeric (gives right-aligned number) or a 1xn-cell-array (gives pop-up menus with different choices).
It is set using the columnformat property of uitable, e.g.
columnformat = {'numeric', 'logical', {'Fixed' 'Adjustable'}}; % 3 columns
You can find an example at matlab documentation.
I am looking for a way to set the format for single cells to realize something like this:
Matlab's uitable is a crippled version of an underlying JIDE table.
It is possible to get to the underlying java (see findjobj in file exchange), but that requires a lot of work. Yair Altman's undocumented matlab site is a good starting place for understanding the java side of matlab.
It sounds like you want something like a property editor, as opposed to a generic UI table -- i.e. properties listed in first column, property value editable in second column. There are a few "off the shelf" versions in the file exchange, which use JIDE:
See propertiesgui, or property-grid for mostly functional examples. The second example is easier to use -- you simply provide a class or struct, and it creates the proper field entry format. The first one offers more choices -- like color boxes, drop downs, etc, but requires you to be more involved in specifying how things behave.
I had the same problem, but in the end it worked by giving the (numeric) cell an (char) initial value. When changing the char value from the UI the format of the cell remained char, although the rest of the column was numeric.

Justify last line of UICollectionView

As far as I can see, UICollectionViewFlowLayout justifies all the lines of a section except the last one. So for example, if there aren't enough items to fill more than 1 line, the result is not justified.
What is the simplest way to either configure or subclass UICollectionViewFlowLayout so that it also justifies the last line of a section?
This is not really possible, unfortunately. It's just not designed that way, unfortunately.
One thing I can think of that might work though is to add an extra item into the data source, returned at the end, which has a cell that is 0 pixels tall and the width of the collection view. That will force the last row to be a single row with just that one item on it and then all rows above it will be justified.
You can do this by subclassing UICollectionViewFlowLayout and overriding layoutAttributesForElementsInRect: and layoutAttributesForItemAtIndexPath: to place all the items in the last line (except the first, which is already correct) where you want them, by changing the frame property of the item's UICollectionViewLayoutAttributes object.

GWT(CellTable):can i add 3 anchors in a cell

is it possible to add 3 anchors/ links in one cell of GWT celltable
like this
add/delete/copy
these are 3 anchors in one cell with different click handlers for all three of them ..
Thanks
What you are looking for is the CompositeCell.
The idea will be for you to create 3 separate Column (or lightweight HasCell impementations using ActionCell.Delegate for example) objects for your actions and instead of adding them to the table one by one you would add them as part of the CompositeCell.
It may seem a little counterintuitive to add HasCell implementations into an actual cell, but here is an example, from another Stackoverflow question: Does anyone have a working examples of ActionCells working within a CompositeCell?
You can't use Anchors because you can't use any widgets. However, you can render three different <a> elements and then override onBrowserEvent to catch clicks on them.
It may be simpler to use three separate columns and use a ClickableTextCell or something similar for each one.

How to mimic a standard html text rendering on iphone?

I have a view with two UITextView elements in it, each of which is tied to an outlet in the controller. The content for these is coming from a database, and is sometimes short an other times long. I want it to look like it would in html, with <p>content1</p><p>content2</p>, such that the distances from the end of content1 to beginning of content2 is fixed, but content2 gets shifted down the page if content1 is long.
Seems like a very basic requirement but I can't quite figure out how to do it with Interface Builder. Would appreciate any help.
Thanks
Interface builder doesn't support specifying relationships between sibling elements; the Cocoa layout engine does everything relative to the containing view.
I'd recommend creating a single UITextView that contains both paragraphs, inserting a single empty line between them. Keep each paragraph in its own instance variable, though, and when either one is updated, update the display as well, reconstructing the combined text from the two separate paragraphs.
You can use the textview's contentSize property to align them relative to each other. This property always reflects the size of the actual laid out text content.