Hi,
I tried it and no difference. Still “number” cells are in general format. So I can’t show them in two decimal format. 100.00 will be 100. Yeah sure they are aligned to right. Same happens in your example.
I’ll try tomorrow. I’ve also tested values as float (not strings) but as I remember it didn’t work. So the problem is with the array driver and not the data set or should it work with array driver? Have you documented this somewhere?
Hi,
I tried it and it didn’t work as expected. Every cell is still in general -format.
Sample data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
array( array ( 'AccountName' => 'Example Account #1', 'ProjectName' => 'Amigurumivirkkaus', 'SubprojectName' => 'Virkkausprosessi', 'SubprojectEndDate' => '29.10.2014', 'EstimatedCost' => '100.00', 'ResourcedInvoicing' => '200.00', ), array ( 'AccountName' => 'Example Account #2', 'ProjectName' => '1036', 'SubprojectName' => 'awsdf', 'SubprojectEndDate' => '14.08.2015', 'EstimatedCost' => '200.00', 'ResourcedInvoicing' => '300.00', ), ); |
Excel options:
1 2 3 4 5 6 7 8 9 10 11 |
array( "file_type" => "Excel5", "start_cell" => "A1", "font" => "Calibri", "font_size" => 11, "protect" => false, "creator" => "xxx", "author" => "xxx", ); |
Extracted from our controller:
1 2 3 4 5 6 7 8 9 10 11 |
$conn = new \jqGridArray(); $grid = new \jqGridRender($conn); // Data is it in $GLOBALS[Export::EXPORT_KEY] $grid->ExportCommand = "SELECT * FROM " . Export::EXPORT_KEY; $grid->setExcelOptions($this->getDefaultExcelOptions()); $grid->exportfile = $this->getExportFileName(); $grid->gSQLMaxRows = Export::EXPORT_MAX_ROWS; // Currently 100000 rows $grid->exportToExcel(); |
So basically it’s pretty simple. I’ve tried with $grid->setColModel($colModel) and it doesn’t make any difference except pdf exports will break if I don’t define it. I tried to check your php code but it’s obfuscated so it’s impossible. Any help will be appreciated.
Hi,
We’re using version 5.0.0 and I’ve tried with Excel5, Excel2007 and XML. XML works fine with numbers but it throws following error: “The file format differs from the format that the file name extension specifies” so it’s no good for us. Only real solution would be export in genuine excel -format. I’m not sure if demo helps because it’s pretty simple export with few text / number fields.
And one more question. I created a colModel for jqGrid. It contains following fields:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
array( 'name' => XXXX::FIELD_ACCOUNT_, 'classes' => '', 'editable' => false, 'align' => 'left', 'hidden' => false, 'hidedlg' => false, 'label' => '', 'sorttype' => 'number', 'formatter' => 'numeric', 'width' => 250, ), |
So does the ‘formatter’ -field have any influence on export cell types?
Hi,
Sorry for delay! Here is the $data array content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
array ( 0 => array ( 0 => array ( 'Id' => '369', 'Name' => 'Test user', 'CompanyId' => '0', 'CompanyName' => 'Test Company', 'CostCenterId' => '0', 'CostCenterName' => NULL, 'SubprojectId' => '1787', 'SubProjectName' => 'Test subproject name', 'SubProjectNamePart' => 'Osaprojekti', 'BillabilityTypeId' => '0', 'ProjectId' => '4178', 'ProjectName' => 'Test project name', 'AccountId' => '4916', 'AccountName' => 'Test account name', 'A1_InvoicedHours' => '0.00', 'B1_HoursInvoicedPrice' => '10.50', 'B2_HoursPriceListPrice' => '0.00', 'C1_InvoiceableItems' => '0.00', 'C2_InvoiceableMaterials' => '0.00', 'D1_InvoiceableItemsPrice' => '0.00', 'D2_InvoiceableItemsPrice' => '0.00', 'E_Sales' => '0.00', 'F1_MaterialSales' => '3.00', 'F2_MaterialSales' => '3.00', 'G_TravelInvoiceSales' => '0.00', 'A2_Hours' => '0.00', 'H_HourCost' => '0.00', 'I1_MaterialPurchases' => '0.00', 'I2_MaterialPurchases' => '0.00', 'J_TravelInvoicePurchases' => '0.00', 'K1_Profitability' => '10.50', 'K1_Profitability' => '10.50', 'K2_Profitability' => '13.50', 'K2_Profitability' => '13.50', 'L1_ProfitabilityPercent' => '100.00', 'L1_ProfitabilityPercent' => '100.00', 'L2_ProfitabilityPercent' => '100.00', 'L2_ProfitabilityPercent' => '100.00', 'M1_AverageHourlyRate' => NULL, 'M1_AverageHourlyRate' => NULL, 'M2_AverageHourlyRateInvoicedHours' => NULL, 'M2_AverageHourlyRateInvoicedHours' => NULL, 'N_TargetPrice' => '0.00', ), ), ) |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top