Categories > OpenTBS with XLSX >

Re: Export data to excel

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Suneel
Date: 2014-10-13
Time: 17:34

Re: Export data to excel

In continuation to my earlier post. Please refer below code.

require_once('../tbs_plugin_excel.php');
$TBS1 = new clsTinyButStrong();    //Initialize the TinyButStrong template engine
$TBS1->PlugIn(TBS_INSTALL,TBS_EXCEL);

clsSdkUserManager::exportForSdkUsers($clean_form, $TBS, $TBS1);

public static function exportForSdkUsers($clean_form, $TBS, $TBS1) {
    $GLOBALS['logger']->debug("Running function to export for sdk user(s)...");
    ini_set('max_execution_time', 5000);
    $moderator_id = $_SESSION['logged_in_user'];
    $condition = $GLOBALS['sdkUserActiveRecord']->getBroadSearchResults($clean_form);
    $sdkUserRS = $GLOBALS['sdkUserActiveRecord']->getAllRecords($condition);
   
    $TBS1->LoadTemplate($GLOBALS['templates_dir'] . 'viewSdkExcelUsers.html.php','+');
    $TBS1->MergeBlock('blk1', $sdkUserRS);
   
    $TBS1->PlugIn(TBS_EXCEL,TBS_EXCEL_FILENAME,'Report_'.date('Ymd').'.xlsx');
    $TBS1->Show();
    return true;
   
}       
       
       
        <tr>
          <td align="left" colspan="1" nowrap>[blk1.tt1;block=tr;headergrp=tt1]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt2]</td>
          <td align="left" colspan="1" nowrap><a title="Send Email" href="mailto:[blk1.email]">[blk1.email]</a></td>
          <td align="left" colspan="1" nowrap>[blk1.phone]</td>
          <td align="left" colspan="1" nowrap>[blk1.company]</td>
          <td align="left" colspan="1" nowrap>[blk1.company_region]</td>
          <td align="left" colspan="1" nowrap>[blk1.signup_time]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt3]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt4]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt5]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt6]</td>
         
          <td align="left" colspan="1" nowrap>[blk1.tt7]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt8]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt9]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt10]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt12]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt13]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt14]</td>
         
          <td align="left" colspan="1" nowrap>[blk1.tt15]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt16]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt17]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt18]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt19]</td>
          <td align="left" colspan="1" nowrap>[blk1.tt20]</td>
         
         </tr>
        
I am trying to export an xlsx file with above data (approx 2000 rows and 25 cols ) and it takes about 15 minutes to generate the report. Please suggest me any optimization technique where
i can reduce the report generation time.

I am using latest version downloaded from http://www.tinybutstrong.com/opentbs.php (1.9.2)
Thanks,
Suneel Kumar         
By: Suneel
Date: 2014-10-14
Time: 09:22

Re: Export data to excel

Please suggest.
By: Skrol29
Date: 2014-10-16
Time: 01:02

Re: Export data to excel

Hi Suneel,

I don't really understand.
You say you are using OpenTBS but your snippet tells that you are using the Excel plug-in, which is different.

With OpenTBS 1.9.2 you can test with the command
$TBS->PlugIn(OPENTBS_RELATIVE_CELLS, true, OPENTBS_ALL);
By: suneel
Date: 2014-10-16
Time: 07:26

Re: Export data to excel

Thanks for your response.

Can you please explain what this does?
$TBS->PlugIn(OPENTBS_RELATIVE_CELLS, true, OPENTBS_ALL);
By: Skrol29
Date: 2014-10-21
Time: 01:55

Re: Export data to excel