Hi every one i have use two custom cell in a table view at a time .
Cell one contains labels and buttons
Cell Two Contain next and previous Button
i am adding cell Two at last index of the table view my question is that how can i change the height of cell 2 dynamically
Height of Cell one is 110 and i want the height of cell two is 80 what can i do any idea??
check out heightForRowAtIndexPath here
and return 110 or 80 depending on the indexPath.row
// considered your table have single section and multiple rows...
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == [tableView numberOfRowsInSection:0]-1){
return 80;
}
return 110;
}
Related
Is possible add new rows in the middle of this sheet?
...without affect or overwrite the information at the bottom of the document?
I know that is possible create the bottom info manually, but I have to upload this Excel each month (with different header) and set the start row.
I've tried copy the last rows but duplicateStyle doesn't copy borders and backgrounds
# library
$this->load->library('excel');
$path = './assets/files/uploads/form.xls';
$excel = PHPExcel_IOFactory::load( $path );
$excel->setActiveSheetIndex(1);
$row = 10;
$total = 25;
if( $total >= 20 )
{
$cellValues = $excel->getActiveSheet()->rangeToArray( 'A30:L32' );
$excel->getActiveSheet()->fromArray( $cellValues, null, 'A33' );
$excel->getActiveSheet()->duplicateStyle( $excel->getActiveSheet()->getStyle( 'A30:L30'), 'A32:L32' );
}
There is a Worksheet method called insertNewRowBefore() (and a corresponding method for columns called insertNewColumnBefore()) that do this.
$excel->getActiveSheet()->insertNewRowBefore(10, 5);
will insert 5 new rows into the active worksheet, before row 10... effectively, it pushes row 10 down to row 15, row 11 down to row 16, row 12 down to row 17, etc; adjusting formulae and other cell references accordingly.
Likewise
$excel->getActiveSheet()->insertNewColumnBefore('B');
will insert a single new column (the default for both insertNewRowBefore() and insertNewColumnBefore() is a single row or a single column) before column B.
In the examples folder, 05featuredemo.php and 30template.php demonstrate the use of these methods
And
$excel->getActiveSheet()->duplicateStyle(
$excel->getActiveSheet()->getStyle('A30'),
'A31:A100'
);
should copy all style elements (including borders and background) from a single cell to range of cells; but it won't copy different styles from a range of cells to a new range of cells.
The data set I have is for example and the actual data will have upwards of 100 people. I need to retrieve the top 10 scores from each category in the picture below:
I think the answer is really quite simple.
In each of the corresponding cells, use the "large" forumla.
In cell for vertical 1 it would read large(column vertical, 1) - Returning the largest value in the set.
In cell for vertical 2 it would reage large(colum vertical, 2) - Returning the 2nd largest value in the set.
I have textbox inside gridview. I want to calculate sum of textbox's values. Currently I am using below code which is taking 2sec for just 300 rows. Is there any other ways which takes less time
foreach (GridViewRow row in grdview_newAudit.Rows)
{
TextBox txt = (TextBox)row.Cells[3].FindControl("txt_points");
violationPoints += Convert.ToInt32(txt.Text);
}
My fxml file has the following declaration:
< TableView fx:id="myTable" prefHeight="756.0" prefWidth="472.0" />
then in Java code, I add the columns and then setItems as usual. This works as expected.
The only other code which affects the table is:
myTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
which nicely automatically re-sizes the columns. But I can't figure out how to do the following:
When I add say 1 or 10 items to the table, those appear as expected in the first 1 or 10 rows of the table, but the number of rows in the table are always 21. Rest of the rows are just empty. I want the table to have only 1 row if I set 1 item or 10 rows if I set 10 items. How do I achieve this ?
All the columns are of the same size. I can manually re-size them, but I want columns to auto-fit according to their size. For example if I have 2 columns one with integer from 1-10 and another with text description, they both have equal size. How do I tell it to autofit the column size according the the row contents ?
Thanks for the response!
The table fills up the layout with empty rows. Try hiding them by adding css
.table-row-cell:empty {
-fx-background-color: -fx-background;
}
.table-row-cell:empty .table-cell {
-fx-border-width: 0px;
}
For #2 you can check the length of text in the cells in the cell value factory but I have title problems like that. You can read the data set and figure out what it should be. These are both approximations depending on font size.
Added this, my play cellValueFactory where I tried out some things.
TableColumn<LineItem,String> amountCol = new TableColumn<>("Amount");
amountCol.setPrefWidth(amountCol.getText().length()*20);
amountCol.setCellValueFactory(new Callback<CellDataFeatures<LineItem, String>, ObservableValue<String>>() {
#Override
public ObservableValue<String> call(CellDataFeatures<LineItem, String> p) {
SimpleStringProperty ssp = new SimpleStringProperty(String.format("%.4f", p.getValue().getAmount()));
amountCol.setPrefWidth(Math.max(amountCol.getPrefWidth(), ssp.get().length()*20));
return ssp;
}
});
I have what I hope is a simple question !
I am generating a simple RTF table that is subsequently opened in MS Word. The table is generating fine but the column widths are a little small and causing some word wrapping (not what I want).
The RTF code I generate is for a two line, three column table and is of the form:
\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
{a\cell b\cell c\cell }{\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
\row}
\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
{d\cell e\cell f\cell }{\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
\row}
What do I need to add to set a column width ? I have tried altering the column width in word and then examining the output but it is a little obscure to say the least !
The control words you are looking for are \clwWidthN and \clftsWidthN
Microsoft RTF Specification v1.9.1:
- \clwWidthN
Preferred cell width. Overrides \trautofitN.
- \clftsWidthN
Units for \clwWidthN:
- 0 : Null. Ignore \clwWidthN in favor of \cellxN (Word 97 style of determining cell and row width).
- 1 : Auto, no preferred cell width, ignores \clwWidthN if present; \clwWidthN will generally not be written, giving precedence to row defaults.
- 2 : Percentage (in 50ths of a percent).
- 3 : Twips.
So, in your case, you could just use \clftsWidth1 (automatically set width) or set the preferred percentages yourself e.g. \clwWidth2\clwWidth2500 (2500 = 50%)
Auto width
\trowd \trautofit1
\intbl
\clftsWidth1\cellx1
\clftsWidth1\cellx2
\clftsWidth1\cellx3
{a\cell b\cell c\cell }
40% - 30% - 30%
\trowd \trautofit1
\intbl
\clftsWidth2\clwWidth2000\cellx1
\clftsWidth2\clwWidth1500\cellx2
\clftsWidth2\clwWidth1500\cellx3
{a\cell b\cell c\cell }
The problem is in that you have set very small width for column:
\cellx1
\cellx2
\cellx3
To set width for column in RTF there is a keyword '\cellxN', where N - is column width in twips.
15 twips is 1px.
So if you want to create a simple RTF table with 1 row and 3 columns, 100px each, use this syntax:
\trowd\cellx1500\cellx3000\cellx4500
\intbl A\cell B\cell C\cell\row
You will get a simple table by 300px, 3 columns - 100px each, with invisible borders.
Cheers,
Max
You need to either use cellx0, so that autofit tag applies, or explicity set the number to the number of twips from the left border. In your example, you use 1 2 and 3 which is explicity setting the column widths to be very skinny. For example, something like:
\cellx5125
\Cellx6000
\Cellx8000
Note that these numbers are offsets from the left margin.
If you are going to do any RTF, I highly recomend the RTF Pocket Guide from O'Rielly
Check this link
http://joseluisbz.wordpress.com/2014/04/26/working-rtf-html-css-and-script-files-with-my-own-packages-java-and-php/
you can to make your own file.
TblData = new RTFTable(4,4); //4 Columns, 4 Rows
TblData.setWideCols(1000); //Width of 2000 to put all columns
TblData.setWideCol(0,3000); //Width of 3000 to Column 0