Change color of a cell whose value got through getCellByColumnAndRow - phpspreadsheet

I got a cell whose value is "Duplicate" through getCellByColumnAndRow() in phpspreadsheet.
Now How can I change cell color.
$sheet->getCellByColumnAndRow($col, $row)->getFill();

For the cell background (fill) color, do something like:
$cell->getStyle()
->getFill()
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
->setStartColor('Red');
For the font color, try:
$cell->getStyle()
->getFont()
->setColor('White');
See the Style class for further info:
https://phpoffice.github.io/PhpSpreadsheet/classes/PhpOffice-PhpSpreadsheet-Style-Style.html

Related

Can i only display text in tab bar item and change the style and position

I add a tab bar in storyboard, and do not want to set an image to the tab bar item, and like the following:
How can I change the font and the position for the title of the bar item in storybord?
First select the tab bar item in storyboard, than in Attributes Inspector set System Item and Title Position to Custom, so you will be able to change the position of the title by setting values to Horizontal and Vertical boxes.
Finally, to change the font, in your viewDidLoad(), include:
UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Avenir-BlackOblique", size:20)!, NSForegroundColorAttributeName: UIColor.blue], for: .normal)
NSFontAttributeName allow you to change the font style and NSForegroundColorAttributeName allow you to change the font color.

Conditional formatting in google sheets to inherit formatting from other cell

I've been trying to figure out how to apply conditional formatting to the background of a cell. I've searched the internet but haven't been able to find anything related to this.
I am interested in formatting a cell conditionally, so that if the contents are equal to a text string, the background color will inherit the background color of another cell.
Does anyone know if this is possible and how to accomplish it?
This is the quasi-code for the functionality I am looking to achieve:
If (cell contents are empty) then
Apply background from cell offset two cells to the right
End If
This is not possible with plain conditional formatting, you'll need an onEdit function.
function onEdit(e) {
var r = e.range;
if (e.value.length > 0) {
var reference = e.source.getActiveSheet().getRange(r.getRow(), r.getColumn()-2)
var color = reference.getBackground();
r.setBackground(color);
} else {
r.setBackground("white");
}
}
Note that this will not update the cell's background color when you change the reference cell's background color.

iOS - how to implement custom table view cell selection/unselection?

I'm working with a UITableView, and as far as I understand it has grey or blue selection of rows. Is there a way to override UITableView cell selection behavior (define a "selected" style)?
If there is not, would a vertical collection view work as an imitation of a table view with custom selection?
According to the UITableViewCell Class reference, you are limited to:
UITableViewCellSelectionStyle
The style of selected cells.
Declaration
SWIFT
enum UITableViewCellSelectionStyle : Int {
case None
case Blue
case Gray
case Default
}
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewCell_Class/#//apple_ref/swift/enum/UITableViewCellSelectionStyle
So you would have to develop your own custom action on selection to change the background color.

How to define the borders for an entire column with spreadsheetgear?

I know how to define the style of the border for a Cell, like that for example:
Dim border As SpreadsheetGear.IBorder
border = sheet.Cells(1, column).Borders(SpreadsheetGear.BordersIndex.EdgeRight)
border.Color = System.Drawing.Color.Black
border.LineStyle = SpreadsheetGear.LineStyle.Continuous
border.Weight = SpreadsheetGear.BorderWeight.Medium
This is working.
What I want to do now is to define the style of the border for an entire column. Exactly like what I would obtain if in Excel I select the column by clicking on the header and define the border attributes.
I've tried to do it on this range:
border = sheet.Cells(1, column).Columns.Borders(SpreadsheetGear.BordersIndex.EdgeRight)
The code doen't crash, but it doesn't add a border.
Anybody can help ?
Instead of Columns, try EntireColumn:
border = sheet.Cells(1, column).EntireColumn.Borders(SpreadsheetGear.BordersIndex.EdgeRight)

How to remove No Result TableView of UITableViewCell in iOS?

Actually my TableView's background color is really black.
However when i use SearchBar and search words,if there is no data that match , there will appear "NO Result" UITableView with White Color.
I don't want to appear that White color background with " NO Result " TableViewCell if there are no match words..
How can i remove that White UITableViewCell?
That No Result TableView is i want to remove if there are no result that match.
That tableView comes automatic since it's part of the search, however you can modify by doing this:
Create a boolean flag named noResultsToDisplay (or something else).
If you have no results to display then set noResultsToDisplay = YES, set it to NO otherwise.
In numberOfRowsInSection, if (noResultsToDisplay) return 3;
In cellForRowAtIndexPath, if (noResultsToDisplay && indexPath.row == 2) cell.textLabel.text = #"No Results";

Resources