UITableView height of a section - objective-c

I have a UITableView that has 3 sections. My individual cells vary in height (collapse-expand).
I need a way to figure out the height of each individual section, i.e. the sum of cell heights in each section. Preferably without calculating everything the tableView already has done each time I need it.
I there a way to deduce or access such a value?

Did you look at -rectForSection: (and possibly also -rectForFooterInSection:)?

There is no easy way to calculate the value, however there is a way. If your cells have a fixed height it's just the many rows multiplied by their fixed height for each section.
If you have varying height in the cells too, I'd go for an array which holds the total height for each section, just calculate it once and keep it cached there. If the section is collapsed you just need the section header height else it's the value in the array.

Related

valign images in xlsxwriter cell

Is there any hack for v-aligning images in a cell
I am trying to create a dashboard,those traffic lights are images.
Since once of the columns is a text-wrap and the height of those rows
are dynamic, I have no way of knowing the row height to calculate the y_offset for those images
Does anyone have a recommendation on how I can handle this? Is there a way of getting the row_height after sheet.write and text_wrap format is applied?
Is there a way of getting the row_height after sheet.write and text_wrap format is applied?
Probably not without access to Windows APIs for calculating bounding boxes for strings.
You could probably make some working estimates based on the length of your string. Each new line in text wrap is equal to 15 character units or 20 pixels.
Since once of the columns is a text-wrap and the height of those rows are dynamic, I have no way of knowing the row height to calculate the y_offset for those images
This is the main problem. In order to specify the image position exactly you will need to specify explicit row heights so that XlsxWriter can calculate where the image will go based on the size of the cell. In order words you will have to avoid the automatic row height that Excel gives you when wrapping text.
Once the row height is fixed you can position images exactly where you want them using the 'x_offset' and 'y_offset' options.
Note, you can also use conditional formatting to create traffic lights based on cell values. See Sheet9/Example 9 of this code from the XlsxWriter docs and image below. These can be centered automatically even with with text wrapping.

I'm getting strange numbers when using the VBA Height function

I am trying to use the Height function in VBA but I am getting strange numbers. Instead of returning the height of a range, it is returning the height of a range multiplied by 15. For example, the following simple function :
Function h(c1 As Range) As Double
h = c1.Height
End Function
would give a value of 15 if c1 was a single cell, would give 30 if c1 was two cells high, and so on. I should clarify that I am using this as part of a larger function, but it is this issue that is causing the problem. I wanted to make a function as simple as possible to see if the problem remained, and it has. I really don't understand why this is happening, I have used the height function before with no problem. Any advice would be greatly appreciated,
Thanks
You are misunderstanding what the height property is. The height is its height in points...
From here..https://msdn.microsoft.com/en-us/library/office/aa215509%28v=office.11%29.aspx?f=255&MSPPError=-2147217396
Returns the height of all the rows in the range specified, measured in points. Returns Null if the rows in the specified range aren't all the same height. Read/write Variant.
Remarks
You can use the Height property to return the total height of a range of cells.
Differences between RowHeight and Height include the following:
Height is read-only.
If you return the RowHeight property of several rows, you will either get the row height of each of the rows (if all the rows are the same height) or Null (if they're different heights). If you return the Height property of several rows, you will get the total height of all the rows.
Example
This example doubles the height of row one on Sheet1.
With Worksheets("Sheet1").Rows(1)
.RowHeight = .RowHeight * 2
End With

SSRS Report Printing Incorrectly

I am trying to figure out why a row keeps on blowing up during printing. Here is an example: http://imgur.com/OQD9VEh #2 is where it is getting extended. As you can see it happens when the data continues on to the next page. It is because of the columns on the right where the values are "Family" and "Mom". If I remove those two columns, the report prints out fine. Once I add them back in, the last row, no matter the row, expands dramatically if it is the leading row on the next page.
Things that I have already tried which have not worked:
- Disabling the option to have the cells increase or decrease in height.
- Tried increasing the height and width of the tablix
- Altered the data type and size to only 6 char for both columns on the left
Any ideas?
Add a column to the right of your outermost column and set its width to very small with no borders and background color(invisible). This may do the trick.
have you try to have the same row height same as the above.
try to set the row "Can Shrink" to false and "Can Grow" to false

Why does the last cell show up in the third to last position in a UITableView?

I've got a UITableView filled with UITableViewCells.
Now when I scroll down, there's a problem with the two bottom cells. The last cell shows up as the third from the bottom and there are two additional cells below which shouldn't be there.
What are possible causes of such a behavior?
Editor's note: I hope I correctly interpreted the question. The problem could also be that the last two cells don't show up at all.
The number of cells in the table view stems from the delegate method numberOfRowsInSection:. Check what number is being set here, if you're counting an array then NSLog the count ([MyArray count]) and check to see if its as you expect. Its the only thing I can think of that would lead to additional or missing cells in your tableview without source code

Print on a variable height paper using vb.net

I want to print bill on a roll paper using vb.net.
The requirements are as follows:
The width of the page is 300 pixels or 3 inches.
The height of the page is variable, depending on the number of the rows in the datagrid.
The page header will have an image.
The names of the items could be long, so they should not be chopped, rather print on the next line.
How should I go about it?
Get your Image height and xRows (dgv.rows.count) * Rowheight
So you have an Dynamic height.
Additional you could count string lengtht of your long Values and add for longer datarows the addidtional height
But that is just my idea.
Im sure there are better solutions