-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xavier dutoit
committed
Oct 8, 2010
0 parents
commit 7073787
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
A software company that produces the dominant speadsheet software has been highly creative as what the "C" in "CSV" stands for. In a french version of Excel, it expects as ";" as separator, but a "," in a US version. | ||
|
||
Moreover, the charset is always implicit and never UTF-8. To add insult to injury, there isn't any way for the end user to choose what it the charset. | ||
|
||
Bottom line, there isn't any way to be able to generate a csv that would be always properly read by the dominant speadsheet. That's almost as if done on purpose to make harder to communicate with the "outside" world. Who would be deviant enough to do that on purpose ? | ||
|
||
Long story short, the dominant spreadsheet is able to convert from an html table into its internal format with minimum complaints, hence bypassing all these csv joy. | ||
|
||
Kurund has implemented a hook during the code sprint in Bristol, making the magic possible and the dream true. | ||
|
||
X+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name = CiviCRM Export | ||
description = Export into an excel format directly instead of csv | ||
version = 3.2 | ||
package = CiviCRM | ||
dependencies[] = civicrm | ||
core = 6.x | ||
php = 5.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
function civi_export_civicrm_export( $exportTempTable, $headerRows, $sqlColumns, $exportMode ) { | ||
$writeHeader = true; | ||
$offset = 0; | ||
$limit = 200; | ||
|
||
$query = " | ||
SELECT * | ||
FROM $exportTempTable | ||
"; | ||
require_once 'CRM/Core/Report/Excel.php'; | ||
while ( 1 ) { | ||
$limitQuery = $query . " | ||
LIMIT $offset, $limit | ||
"; | ||
$dao = CRM_Core_DAO::executeQuery( $limitQuery ); | ||
|
||
if ( $dao->N <= 0 ) { | ||
break; | ||
} | ||
|
||
$componentDetails = array( ); | ||
while ( $dao->fetch( ) ) { | ||
$row = array( ); | ||
|
||
foreach ( $sqlColumns as $column => $dontCare ) { | ||
$row[$column] = $dao->$column; | ||
} | ||
|
||
$componentDetails[] = $row; | ||
} | ||
CRM_Core_Report_Excel::writeHTMLFile( "Export_Records", $headerRows, | ||
$componentDetails, null, $writeHeader ); | ||
$writeHeader = false; | ||
$offset += $limit; | ||
} | ||
|
||
CRM_Utils_System::civiExit( ); | ||
} |