in my document I am creating 3-4 pdfptables.
At design time I don't know the size of the tables. I need to place the 2nd table right after the first, but I dont know the position of the first (I can't calculate it because I dont know how big it is). How do I know where to place the second table?
You can figure out the total height of the table dynamically. After you use the WriteSelectedRows() function, you can call the .TotalHeight() property to find out how tall your table was (in points). Then figure out with some calculations where it ends and where the next one should begin.
That's right the table height and width is dynamically calculated, but you don't have to call WriteSelectedRows() function. You have to set either height or width.
In my case I had to first calculate that if font used can fill the page if not I had to dynamically change the font appropriately. So I find (by mistake) if you set TotalWidth the TotalHeight is automatically set/calculated.
Sanjay
Related
Using this article (https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/aa480727(v=msdn.10)#initialization) and the library included in the demo project I have setup Excel-like autofiltering on a datagridview.
However on columns where there are not many distinct values, only one or two rows are displayed:
In this example, there are actually 3 or 4 values in the filter list that the user could select but only two rows are displayed and the rest you must scroll to find.
I've been unable to find where the height of the list box is set. Any can anyone point out where I can change/set this?
I believe that this may be what you are looking for.
In the documentation is the following paragraph:
The SetDropDownListBoxBounds Method
The SetDropDownListBoxBounds method initializes the size and location of the drop-down list.
The preferred size depends primarily on the dropDownListBox contents, which are the formatted values stored in the Keys collection of the filters dictionary. The SetDropDownListBoxBounds method first calls the Graphics.MeasureString method for each filter value. For each value, the width is stored if it is wider than all previous values, and the height is added to an accumulating total height for all values. The results are then used to determine the preferred size.
The preferred height is the smallest of the following values:
The accumulated height of all filter values.
The user-specified maximum height as calculated from the
DropDownListBoxMaxLines property value.
The available height of the DataGridView control client area.
I'm having a difficult time figuring out how to designing what feels like it should be a fairly straightforward layout for my collection view. The heights of each cell are equal. The widths vary. The inter-item spacing should always be equal. The distance between rows should also always be equal. As more items are added, the width of the collection view will increase "intelligently." Let me give an example.
When I insert a new item, I will calculate the movement of items from rows (maybe the first item of row 1 moves up to row 0, maybe the first item of row 2 moves up to row 1. I then move it and the collection view grows wider.
I feel like this should be reasonably straightforward but I'm struggling.
Does anyone have some sample code that could help?
Have you tried this using UICollectionViewFlowLayout?
http://skeuo.com/uicollectionview-custom-layout-tutorial
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewFlowLayout_class/
Is there a way of getting the height of a table before adding it to the document?
At first glance, I supposed that the number of rows in the table is enough to calculate height since I know the font size. However, some rows break that rule. For instance, one cell might store a paragraph that has more than one line. Hence, what I need to know is the total of the heights of every row.
Yeah, answer was not complicated.
In order to get the height of a table, one must set the width of the table first. In other words,
table.setTotalWidth((PageSize.A4.getWidth() - document.leftMargin()
- document.rightMargin()) * table.getWidthPercentage() / 100);
System.out.println(table.calculateHeights());
does give the height of the table.
If you want to get table's height dynamically you can do so only after you have added all the content to it. In order to make this work you have to set its fixed width property and locked width property first.
e.g.
table.setTotalWidth(555f);
table.setLockedWidth(true);
after this you can get table's height by using its table.getTotalHeight() method
I have a grouped table with two sections where I display text with different length and therefore cell height.
I have solved the problem with the different length/height with constrainedToSize in cellForRowAtIndexPath.
Now I want to add a section with one single row in which I want to show a picture.
How should I best implement that? (still a bit of a beginner with the Objective C)
I would guess that I would have to create an UIImageView and somehow link that to the cell, but my biggest concern is how do I do with the dequeueReusableCellWithIdentifier now that I will have two different type of cells?
Appreciate any advice that will help me save time from trial and error!
I ended up doing this:
Since my image is in my first section (and nothing else in that section) I divided my cellForRowAtIndexPath in to two parts with a simple if statement. One for the first section and one for the rest. Then I use two different dequeueReusableCellWithIdentifier and can set up two kind of cells. So far it work fine.
I want to build a report that is completely static in size and shape. I'm attempting to mimic a hand-entered report that someone in my organization has been building from a word doc for years.
The critical piece appears to be fixing the number of rows that are produced in the various Table grids that fill the page. I would like them to always contain a set number of rows, whether data is present or not. It would seem that if I can just fix the size my tables, then all the other elements will not be forced to move because of stretching repeater sections.
All my grids are backed by stored procedures, so I'm open to SQL tricks as well.
Sorry i did miss-read the question.
If you know how many rows you need to return (say 20) maybe you could pad some bogus info into your records returned from the stored procedure. You might be able to count the records your query has returned before you send them back, and if you have less than 20 add some bogus ones to the record set, put something like 'NonDisp' or something in them.
Then in the report put an iif statement into the cells that checks for this bogus info, if it is found change the cell to display nothing, otherwise show the valid values
Not a direct answer, but perhaps a workaround you might consider: perhaps you can insert a page break after the table grids that have dynamic sizes, so that all elements that follow it have a fixed position (relative to the top of the page).
Add a parent group to tablix with =Ceiling((RowNumber(Nothing)) / 10000) expression. (10000 or whatever is required no. of rows)
In page break properties of group, check box for insert break between groups, leave the bottom boxes un-checked.
Optionally, we may chose to set hidden property true for text boxes added because of new parent group.
In tablix properties, check box for "Keep together on one page".