Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Title before the column header #3

Open
rangganovsky opened this issue Oct 24, 2013 · 2 comments
Open

add Title before the column header #3

rangganovsky opened this issue Oct 24, 2013 · 2 comments
Assignees

Comments

@rangganovsky
Copy link

i think, it would be nice addition to this great extension if we can add some title before the column header.

and also if possible, we can decide/format where to put it. so i imagine that, we can add any kind of information (it could be title, date time, etc) before we render the column header. as the most of the excel report need to have a some title or date.

what do you think? is it possible for that?

@ghost ghost assigned abennouna Oct 26, 2013
@mysoundmagic
Copy link

is features such as the above, already at version 1.1.10 ?

@ebraho
Copy link

ebraho commented Sep 28, 2015

Adding a title before table:

in tlbExcelView.php add the following code:

public $reportTitle = '';
.
.
.
public function run(){
   $styleTitle = array(
      'font'=>array(
                'bold'=>true,
                'size'=>'20',
         )
   );

   self::$activeSheet
      ->insertNewRowBefore(1, 3) //insert 3 rows before the table
      ->setCellValue('A'.'2', $this->reportTitle)
      ->mergeCells('A2:C2'); //or more if the title is too long
   self::$activeSheet
      ->getStyle('A2')->applyFromArray($styleTitle);
.
.
.

then in the view where you call the tlbexcelview widget, add the new attribute:

$this->widget('application.components.widgets.tlbExcelView', array(
.
.
.
'reportTitle' => 'Set the title of your report here',
.
.
.

The same way you can add other attributes like DATE or whatever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants