Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Add Addition columns for exported csv file

Hello all.

I chosen to use PhPexcel for exported report file. I use LDAP and I need to add addtional columns to exported "CSV" file like phone and etc. Picture bellow shows what exactly I need. My problem is I can use only ID of columns and can not find variables of each column to call them. Also I need to set automatic rowspan, but do not know variables name to write a code. Here is my code for exported file:
-------------------------------------------------------------------------------------------------------------------------------------------------

function downloadTabularData()
{
$data = $this->getData();

/** PHPExcel */
include '../phpexcel/Classes/PHPExcel.php';

/** PHPExcel_Writer_Excel2007 */
include '../phpexcel/Classes/PHPExcel/Writer/Excel2007.php';

$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Orik3ll0");

// Optionally, set the title of the Sheet
$objPHPExcel->getActiveSheet()->setTitle('Department Statistics');



$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue('A1', Help Topic);
$objPHPExcel->getActiveSheet()->SetCellValue('B1', Opened);
$objPHPExcel->getActiveSheet()->SetCellValue('C1', Assigned);
$objPHPExcel->getActiveSheet()->SetCellValue('D1', Overdue);
$objPHPExcel->getActiveSheet()->SetCellValue('E1', Closed);
$objPHPExcel->getActiveSheet()->SetCellValue('F1', Reopened);



$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);

$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);


$objPHPExcel->getActiveSheet()->SetCellValue('A2', $data['data'][0][0]);
$objPHPExcel->getActiveSheet()->SetCellValue('B2', $data['data'][0][1]);
$objPHPExcel->getActiveSheet()->SetCellValue('C2', $data['data'][0][2]);
$objPHPExcel->getActiveSheet()->SetCellValue('D2', $data['data'][0][3]);
$objPHPExcel->getActiveSheet()->SetCellValue('E2', $data['data'][0][4]);
$objPHPExcel->getActiveSheet()->SetCellValue('F2', $data['data'][0][5]);

$objPHPExcel->getActiveSheet()->SetCellValue('A3', $data['data'][1][0]);
$objPHPExcel->getActiveSheet()->SetCellValue('B3', $data['data'][1][1]);
$objPHPExcel->getActiveSheet()->SetCellValue('C3', $data['data'][1][2]);
$objPHPExcel->getActiveSheet()->SetCellValue('D3', $data['data'][1][3]);
$objPHPExcel->getActiveSheet()->SetCellValue('E3', $data['data'][1][4]);
$objPHPExcel->getActiveSheet()->SetCellValue('F3', $data['data'][1][5]);
-------------------------------------------------------------------------------------------------------------------------------------------------

Thank your for your attention and help!
Best Regards
Orik3ll0

Comments

  • https://www.dropbox.com/s/kgv5c9umgdq692e/Снимок.JPG?dl=0

    Link for picture in case if picture is not visible like in my case)
  • edited September 2016

    Hello orik3ll0,

    this columns are missing the Picture ...

    $objPHPExcel->getActiveSheet()->SetCellValue('A1', Help Topic);
    $objPHPExcel->getActiveSheet()->SetCellValue('B1', Opened);
    $objPHPExcel->getActiveSheet()->SetCellValue('C1', Assigned);
    $objPHPExcel->getActiveSheet()->SetCellValue('D1', Overdue);
    $objPHPExcel->getActiveSheet()->SetCellValue('E1', Closed);
    $objPHPExcel->getActiveSheet()->SetCellValue('F1', Reopened);

    which data come from osticket and which from LDAP?

    Best Regards
    citrixraptor
  • edited September 2016

    Dear Citrixraptor


    I need to get all tickets in xlsx or csvwith these information from export button.All these are in database.


    $objPHPExcel->getActiveSheet()->SetCellValue('A1', Date);------------->Osticket(created date) ;

    $objPHPExcel->getActiveSheet()->SetCellValue('B1', Department);---->LDAP

    $objPHPExcel->getActiveSheet()->SetCellValue('C1', Phone); ----------> LDAP

    $objPHPExcel->getActiveSheet()->SetCellValue('D1', From);------------->LDAP(Who created ticket)

    $objPHPExcel->getActiveSheet()->SetCellValue('E1', Topic Parent);------->Osticket(parent)

    $objPHPExcel->getActiveSheet()->SetCellValue('F1', Topic Child);--------->Osticket(child)

    $objPHPExcel->getActiveSheet()->SetCellValue('G1',Status);--->Osticket(opened/closed/overdue/assigned)

    $objPHPExcel->getActiveSheet()->SetCellValue('H1', Topic Agent);--------->LDAP(who is responsible for ticket)


    Thank you for your attention and help


    Best Regards

    Orik3ll0

Sign In or Register to comment.