PHPExcel white background - background

I am importing an Excel spreadsheet into a web page using the PHPExcel libraries:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');
it works but it overrides my page background to white. Every other element on the page it's formatted correctly according to my CSS but not the background. Any idea?

The default background for an Excel cell is white, so you probably want to change that. I don't know where you're setting the page background in the first place, unless you've modified the HTML Writer to do so, or changed it in the Excel file (you don't indicate which); but try setting a default cell background for the worksheet:
$objPHPExcel->getDefaultStyle()->applyFromArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFFFFF00')
),
)
);

Mark Baker point me in the right direction to answer my own question, this is the reason why I marked his answer as the accepted one.
To fix my problem I have added the following lines:
$objWriter->generateStyles(false);
echo $objWriter->generateSheetData();
after:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');

Related

Disable the back button in navigation bar

I need to get rid of only the arrow in the navigation bar in Xamarin forms. I tried in but I didn't get a proper solution. please help me overcome this issue. Thanks in advance.
!! I NEED TO REMOVE PERMANENTLY
solutions that I'm tried up to now :
Shell.SetBackButtonBehavior(this, new BackButtonBehavior
{
IsEnabled=false
});
but still, this didn't help me
There is a easy workaround to solve this.
You could override a Icon with a transparent png file(Follow is a transparent png):
and set enabled be false as follows:
Shell.SetBackButtonBehavior(this, new BackButtonBehavior
{
IconOverride = "transparent.png",
IsEnabled = false
}) ;
Then the effect as follows:
Note: You will see that we also can tap that area, therefore we need to set enabled be false.
Based on this official sample to test that.
You can set this using the Xamarin.Forms.NavigationPage class, from within a view's code behind file. E.g. within a ContentPage's constructor.
NavigationPage.SetHasBackButton(this, false);

How to remove Label for attribute from checkBoxList in yii

$records_skincolor1 = array('Black'=> 'Black','Brown'=> 'Brown','Dark Brown'=> 'Dark Brown','Blue'=> 'Blue','Grey Blue'=> 'Grey Blue','Hazel'=> 'Hazel','True Green'=> 'True Green');
echo CHtml::checkBoxList('Superadvancesearch[talent_skincolor][]','',$records_skincolor1, array(
'template'=><li>{input}{label}</li>,
'separator'=>'',
));
I need to remove label for attribute. How to remove it.
If you use Yii 1.1.14 you can use the new beginLabel, labelTitle and endLabel placeholder. In this case, no for will be rendered:
'template' => '{input}{beginLabel}{labelTitle}{endLabel}'
But to be honest I can hardly see a reason why you would want to remove this attribute. Because then you can't click the label anymore to check/uncheck a checkbox. Maybe your rather look for surrounding labels:
'template' => '{beginLabel}{input}{labelTitle}{endLabel}'
This is how Bootstrap expects checkboxes and here the label can still be clicked to check/uncheck the checkbox.
The same works for radiobuttons, too, BTW.
you can do this:
you are giving an array to your CHtml::checkBoxList method.
you just define the array before this method and make it with your condition.
if ($value == $someValue)
$yourArray=array(
'template'=><li>{input}{label}</li>,
'separator'=>'',);
else
$yourArray=array(
'template'=><li>{input}</li>,
'separator'=>'',);
and give this to your method:
echo CHtml::checkBoxList('Superadvancesearch[talent_skincolor][]','',$records_skincolor1, $yourArray
));
cheers.

How can I make a tooltip link to another page?

In the data gridview, I am able to put tooltip (http://yiibooster.clevertech.biz/javascript.html#tooltips) by using headerHtmlOptions and get the data from the database.
My problem is that I can't find a way to put a link in the tooltip. For example, "This is tooltip. See more.." If 'See more..' is clicked it should go to another page. Thanks.
Try this with changes of your script!
array(
'header'=>'Video Url',
'name' => 'video_url',
//'value' => 'CHtml::link($data->title,$data->video_url, array("target"=>"_blank"))',
'value' => 'CHtml::link("View Video", $data->video_url, array("target"=>"_blank"))',
'type' => 'raw',
),
Perhaps you are missing target_blank
I have found this extension (http://www.yiiframework.com/extension/tooltipster/) and it works the way i want. It made possible for me to have a tooltip with link. :))

Railscast 153 revised: setting a background image

I'm trying to generate a PDF following the instructions given in http://railscasts.com/episodes/153-pdfs-with-prawn-revised
I'm able to put a background image on a specific page by doing this:
image "#{Rails.root.to_s}/public/document_assets/1_cover.png", :at => [bounds.left - 30, bounds.top + 50], :fit => [#width, #height]
I also got an image to render on the background of multiple pages at once using:
repeat(2..3) { canvas { image("#{Rails.root.to_s}/public/document_assets/1_bg.png", :at => bounds.top_left, :fit => [#width, #height]) } }
but that renders the image on top of everything else on the page, so no text or other content is visible.
I can't seem to figure out how to set the background image property as described in the Prawn documentation. Does anyone know how to do this?
Thanks!
I figured out the problem. You can set the background option in the PDF class where the margins get set in the railscast example. My issue was that the image I was using was not the right size. When I sized it to 8.5x11" and 72px per inch, it worked.

CMenu - active class not rendering

'items'=>array(
array(
'label'=>'About',
'url'=>array('about/index')
),
about/index - we get the class on the menu - active.
about/graphic - we don't get the class on the menu active.
about/print - we don't get the class on the menu active.
Please note that the menu has NO subitems.
Only About.
No mater if the user is on graphic, print or whatever, we wish to have the About highlighted.
How can we accomplish this ?
I've tried to edit that 'url' param a lot. No luck.
'items'=>array(
array(
'label'=>'About',
'url'=>array('about/index'),
'active'=>Yii::app()->controller->id=='about',
),
Added the active param. This worked.
active: boolean, optional, whether this menu item is in active state
(currently selected). If a menu item is active and activeClass is not
empty, its CSS class will be appended with activeClass. If this option
is not set, the menu item will be set active automatically when the
current request is triggered by url. Note that the GET parameters
not specified in the 'url' option will be ignored.
I've set that property. Otherwise it wouldn't work.
However, as you can see on the bold line, they say this should be automatically triggered. It wasn't on this case.
I suppose this was the case due to the fact that Yii is expecting a child element of About in order to apply that class, since there's any, we have to force it, to get the parent instead.
Not sure however.
CMenu is comparing item's route to current route, so by default it will work only for about/index.
I see two ways of forcing it - first is just set 'active' => true in items list:
$isActive = strpos(Yii::app()->controller->route, 'about/') === 0;
// ....
'items'=>array(
array(
'label'=>'About',
'url'=>array('about/index'),
'active' => $isActive
),
Or you can subclass CMenu class and overwrite CMenu::isItemActive($item,$route) method
simple but effective:
$action = Yii::app()->controller->action->id; // this is the action name currently running
'items'=>array(
array(
'label'=>'About',
'url'=>'/about/something',
'active'=>$action == 'something',
),
also...
to activate a menu, regardless of the action, just for a controller:
$controller = Yii::app()->controller->id; // this is the controller name
...
'active'=>$controller == 'something',
Notes:
add the $controller or $action variables, you can use them for more menu items. Your code will be cleaner.
you'll be 100% sure, the menu items will 'stick' active