Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
This commit is contained in:
@@ -145,6 +145,7 @@
|
||||
- rfe #1640812 [auth] Add example for OpenID authentication using signon method.
|
||||
- rfe #1312657 [dbi] Default to mysqli extension.
|
||||
- rfe #1168350 [interface] Add clear button to SQL edit box.
|
||||
- [core] Update library PHPExcel to version 1.7.6
|
||||
|
||||
3.3.10.0 (not yet released)
|
||||
- patch #3147400 [structure] Aria table size printed as unknown,
|
||||
|
331
js/functions.js
331
js/functions.js
@@ -380,328 +380,6 @@ function checkSqlQuery(theForm)
|
||||
return true;
|
||||
} // end of the 'checkSqlQuery()' function
|
||||
|
||||
// Global variable row_class is set to even
|
||||
var row_class = 'even';
|
||||
|
||||
/**
|
||||
* Generates a row dynamically in the differences table displaying
|
||||
* the complete statistics of difference in table like number of
|
||||
* rows to be updated, number of rows to be inserted, number of
|
||||
* columns to be added, number of columns to be removed, etc.
|
||||
*
|
||||
* @param index index of matching table
|
||||
* @param update_size number of rows/column to be updated
|
||||
* @param insert_size number of rows/coulmns to be inserted
|
||||
* @param remove_size number of columns to be removed
|
||||
* @param insert_index number of indexes to be inserted
|
||||
* @param remove_index number of indexes to be removed
|
||||
* @param img_obj image object
|
||||
* @param table_name name of the table
|
||||
*/
|
||||
|
||||
function showDetails(i, update_size, insert_size, remove_size, insert_index, remove_index, img_obj, table_name)
|
||||
{
|
||||
// The path of the image is split to facilitate comparison
|
||||
var relative_path = (img_obj.src).split("themes/");
|
||||
|
||||
// The image source is changed when the showDetails function is called.
|
||||
if (relative_path[1] == 'original/img/new_data_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data_selected_hovered.jpg";
|
||||
img_obj.alt = PMA_messages['strClickToUnselect']; //only for IE browser
|
||||
} else if (relative_path[1] == 'original/img/new_struct_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct_selected_hovered.jpg";
|
||||
img_obj.alt = PMA_messages['strClickToUnselect'];
|
||||
} else if (relative_path[1] == 'original/img/new_struct_selected_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct_hovered.jpg";
|
||||
img_obj.alt = PMA_messages['strClickToSelect'];
|
||||
} else if (relative_path[1] == 'original/img/new_data_selected_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data_hovered.jpg";
|
||||
img_obj.alt = PMA_messages['strClickToSelect'];
|
||||
}
|
||||
|
||||
var div = document.getElementById("list");
|
||||
var table = div.getElementsByTagName("table")[0];
|
||||
var table_body = table.getElementsByTagName("tbody")[0];
|
||||
|
||||
//Global variable row_class is being used
|
||||
if (row_class == 'even') {
|
||||
row_class = 'odd';
|
||||
} else {
|
||||
row_class = 'even';
|
||||
}
|
||||
// If the red or green button against a table name is pressed then append a new row to show the details of differences of this table.
|
||||
if ((relative_path[1] != 'original/img/new_struct_selected_hovered.jpg') && (relative_path[1] != 'original/img/new_data_selected_hovered.jpg')) {
|
||||
|
||||
var newRow = document.createElement("tr");
|
||||
newRow.setAttribute("class", row_class);
|
||||
newRow.className = row_class;
|
||||
// Id assigned to this row element is same as the index of this table name in the matching_tables/source_tables_uncommon array
|
||||
newRow.setAttribute("id" , i);
|
||||
|
||||
var table_name_cell = document.createElement("td");
|
||||
table_name_cell.align = "center";
|
||||
table_name_cell.innerHTML = table_name ;
|
||||
|
||||
newRow.appendChild(table_name_cell);
|
||||
|
||||
var create_table = document.createElement("td");
|
||||
create_table.align = "center";
|
||||
|
||||
var add_cols = document.createElement("td");
|
||||
add_cols.align = "center";
|
||||
|
||||
var remove_cols = document.createElement("td");
|
||||
remove_cols.align = "center";
|
||||
|
||||
var alter_cols = document.createElement("td");
|
||||
alter_cols.align = "center";
|
||||
|
||||
var add_index = document.createElement("td");
|
||||
add_index.align = "center";
|
||||
|
||||
var delete_index = document.createElement("td");
|
||||
delete_index.align = "center";
|
||||
|
||||
var update_rows = document.createElement("td");
|
||||
update_rows.align = "center";
|
||||
|
||||
var insert_rows = document.createElement("td");
|
||||
insert_rows.align = "center";
|
||||
|
||||
var tick_image = document.createElement("img");
|
||||
tick_image.src = "./themes/original/img/s_success.png";
|
||||
|
||||
if (update_size == '' && insert_size == '' && remove_size == '') {
|
||||
/**
|
||||
This is the case when the table needs to be created in target database.
|
||||
*/
|
||||
create_table.appendChild(tick_image);
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = "--";
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else if (update_size == '' && remove_size == '') {
|
||||
/**
|
||||
This is the case when data difference is displayed in the
|
||||
table which is present in source but absent from target database
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = insert_size;
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else if (remove_size == '') {
|
||||
/**
|
||||
This is the case when data difference between matching_tables is displayed.
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
update_rows.innerHTML = update_size;
|
||||
insert_rows.innerHTML = insert_size;
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else {
|
||||
/**
|
||||
This is the case when structure difference between matching_tables id displayed
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = insert_size;
|
||||
remove_cols.innerHTML = remove_size;
|
||||
alter_cols.innerHTML = update_size;
|
||||
delete_index.innerHTML = remove_index;
|
||||
add_index.innerHTML = insert_index;
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = "--";
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
}
|
||||
table_body.appendChild(newRow);
|
||||
|
||||
} else if ((relative_path[1] != 'original/img/new_struct_hovered.jpg') && (relative_path[1] != 'original/img/new_data_hovered.jpg')) {
|
||||
//The case when the row showing the details need to be removed from the table i.e. the difference button is deselected now.
|
||||
var table_rows = table_body.getElementsByTagName("tr");
|
||||
var j;
|
||||
var index = 0;
|
||||
for (j=0; j < table_rows.length; j++)
|
||||
{
|
||||
if (table_rows[j].id == i) {
|
||||
index = j;
|
||||
table_rows[j].parentNode.removeChild(table_rows[j]);
|
||||
}
|
||||
}
|
||||
//The table row css is being adjusted. Class "odd" for odd rows and "even" for even rows should be maintained.
|
||||
for(index = 0; index < table_rows.length; index++)
|
||||
{
|
||||
row_class_element = table_rows[index].getAttribute('class');
|
||||
if (row_class_element == "even") {
|
||||
table_rows[index].setAttribute("class","odd"); // for Mozilla firefox
|
||||
table_rows[index].className = "odd"; // for IE browser
|
||||
} else {
|
||||
table_rows[index].setAttribute("class","even"); // for Mozilla firefox
|
||||
table_rows[index].className = "even"; // for IE browser
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the image on hover effects
|
||||
*
|
||||
* @param img_obj the image object whose source needs to be changed
|
||||
*
|
||||
*/
|
||||
function change_Image(img_obj)
|
||||
{
|
||||
var relative_path = (img_obj.src).split("themes/");
|
||||
|
||||
if (relative_path[1] == 'original/img/new_data.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data_hovered.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_struct.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct_hovered.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_struct_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_data_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_data_selected.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data_selected_hovered.jpg";
|
||||
} else if(relative_path[1] == 'original/img/new_struct_selected.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct_selected_hovered.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_struct_selected_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_struct_selected.jpg";
|
||||
} else if (relative_path[1] == 'original/img/new_data_selected_hovered.jpg') {
|
||||
img_obj.src = "./themes/original/img/new_data_selected.jpg";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the URL containing the list of selected table ids for synchronization and
|
||||
* a variable checked for confirmation of deleting previous rows from target tables
|
||||
*
|
||||
* @param token the token generated for each PMA form
|
||||
*
|
||||
*/
|
||||
function ApplySelectedChanges(token)
|
||||
{
|
||||
var div = document.getElementById("list");
|
||||
var table = div.getElementsByTagName('table')[0];
|
||||
var table_body = table.getElementsByTagName('tbody')[0];
|
||||
// Get all the rows from the details table
|
||||
var table_rows = table_body.getElementsByTagName('tr');
|
||||
var x = table_rows.length;
|
||||
var i;
|
||||
/**
|
||||
Append the token at the beginning of the query string followed by
|
||||
Table_ids that shows that "Apply Selected Changes" button is pressed
|
||||
*/
|
||||
var append_string = "?token="+token+"&Table_ids="+1;
|
||||
for(i=0; i<x; i++){
|
||||
append_string += "&";
|
||||
append_string += i+"="+table_rows[i].id;
|
||||
}
|
||||
|
||||
// Getting the value of checkbox delete_rows
|
||||
var checkbox = document.getElementById("delete_rows");
|
||||
if (checkbox.checked){
|
||||
append_string += "&checked=true";
|
||||
} else {
|
||||
append_string += "&checked=false";
|
||||
}
|
||||
//Appending the token and list of table ids in the URL
|
||||
location.href += token;
|
||||
location.href += append_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an error message if any text field
|
||||
* is left empty other than the port field.
|
||||
*
|
||||
* @param string the form name
|
||||
* @param object the form
|
||||
*
|
||||
* @return boolean whether the form field is empty or not
|
||||
*/
|
||||
function validateConnection(form_name, form_obj)
|
||||
{
|
||||
var check = true;
|
||||
var src_hostfilled = true;
|
||||
var trg_hostfilled = true;
|
||||
|
||||
for (var i=1; i<form_name.elements.length; i++)
|
||||
{
|
||||
// All the text fields are checked excluding the port field because the default port can be used.
|
||||
if ((form_name.elements[i].type == 'text') && (form_name.elements[i].name != 'src_port') && (form_name.elements[i].name != 'trg_port')) {
|
||||
check = emptyFormElements(form_obj, form_name.elements[i].name);
|
||||
if (check==false) {
|
||||
element = form_name.elements[i].name;
|
||||
if (form_name.elements[i].name == 'src_host') {
|
||||
src_hostfilled = false;
|
||||
continue;
|
||||
}
|
||||
if (form_name.elements[i].name == 'trg_host') {
|
||||
trg_hostfilled = false;
|
||||
continue;
|
||||
}
|
||||
if ((form_name.elements[i].name == 'src_socket' && src_hostfilled==false) || (form_name.elements[i].name == 'trg_socket' && trg_hostfilled==false))
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!check) {
|
||||
form_obj.reset();
|
||||
element.select();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
element.focus();
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a form's element is empty.
|
||||
* An element containing only spaces is also considered empty
|
||||
@@ -1821,6 +1499,8 @@ $(document).ready(function() {
|
||||
$('#properties_message')
|
||||
.addClass('error')
|
||||
.html(data.error);
|
||||
// scroll to the div containing the error message
|
||||
$('#properties_message')[0].scrollIntoView();
|
||||
}
|
||||
}) // end $.post()
|
||||
} // end if ($form.hasClass('ajax')
|
||||
@@ -2451,15 +2131,16 @@ function PMA_init_slider() {
|
||||
$('.pma_auto_slider').each(function(idx, e) {
|
||||
if ($(e).hasClass('slider_init_done')) return;
|
||||
$(e).addClass('slider_init_done');
|
||||
$('<span id="anchor_status_' + e.id + '"><span>')
|
||||
$('<span id="anchor_status_' + e.id + '"></span>')
|
||||
.insertBefore(e);
|
||||
PMA_set_status_label(e.id);
|
||||
|
||||
$('<a href="#' + e.id + '" id="anchor_' + e.id + '">' + e.title + '</a>')
|
||||
.insertBefore(e)
|
||||
.click(function() {
|
||||
$('#' + e.id).toggle('clip');
|
||||
PMA_set_status_label(e.id);
|
||||
$('#' + e.id).toggle('clip', function() {
|
||||
PMA_set_status_label(e.id);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
@@ -126,6 +126,9 @@ foreach ($js_messages as $name => $js_message) {
|
||||
/* Calendar */
|
||||
echo "var themeCalendarImage = '" . $GLOBALS['pmaThemeImage'] . 'b_calendar.png' . "';\n";
|
||||
|
||||
/* Image path */
|
||||
echo "var pmaThemeImage = '" . $GLOBALS['pmaThemeImage'] . "';\n";
|
||||
|
||||
/* Version */
|
||||
echo "var pmaversion = '" . PMA_VERSION . "';\n";
|
||||
|
||||
|
@@ -3,6 +3,303 @@
|
||||
* for server_synchronize.php
|
||||
*
|
||||
*/
|
||||
|
||||
// Global variable row_class is set to even
|
||||
var row_class = 'even';
|
||||
|
||||
/**
|
||||
* Generates a row dynamically in the differences table displaying
|
||||
* the complete statistics of difference in table like number of
|
||||
* rows to be updated, number of rows to be inserted, number of
|
||||
* columns to be added, number of columns to be removed, etc.
|
||||
*
|
||||
* @param index index of matching table
|
||||
* @param update_size number of rows/column to be updated
|
||||
* @param insert_size number of rows/coulmns to be inserted
|
||||
* @param remove_size number of columns to be removed
|
||||
* @param insert_index number of indexes to be inserted
|
||||
* @param remove_index number of indexes to be removed
|
||||
* @param img_obj image object
|
||||
* @param table_name name of the table
|
||||
*/
|
||||
|
||||
function showDetails(i, update_size, insert_size, remove_size, insert_index, remove_index, img_obj, table_name)
|
||||
{
|
||||
// a jQuery object
|
||||
var $img = $(img_obj);
|
||||
|
||||
$img.toggleClass('selected');
|
||||
|
||||
// The image source is changed when the showDetails function is called.
|
||||
if ($img.hasClass('selected')) {
|
||||
if ($img.hasClass('struct_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.jpg');
|
||||
}
|
||||
if ($img.hasClass('data_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.jpg');
|
||||
}
|
||||
} else {
|
||||
if ($img.hasClass('struct_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.jpg');
|
||||
}
|
||||
if ($img.hasClass('data_img')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
var div = document.getElementById("list");
|
||||
var table = div.getElementsByTagName("table")[0];
|
||||
var table_body = table.getElementsByTagName("tbody")[0];
|
||||
|
||||
//Global variable row_class is being used
|
||||
if (row_class == 'even') {
|
||||
row_class = 'odd';
|
||||
} else {
|
||||
row_class = 'even';
|
||||
}
|
||||
// If the red or green button against a table name is pressed then append a new row to show the details of differences of this table.
|
||||
if ($img.hasClass('selected')) {
|
||||
var newRow = document.createElement("tr");
|
||||
newRow.setAttribute("class", row_class);
|
||||
newRow.className = row_class;
|
||||
// Id assigned to this row element is same as the index of this table name in the matching_tables/source_tables_uncommon array
|
||||
newRow.setAttribute("id" , i);
|
||||
|
||||
var table_name_cell = document.createElement("td");
|
||||
table_name_cell.align = "center";
|
||||
table_name_cell.innerHTML = table_name ;
|
||||
|
||||
newRow.appendChild(table_name_cell);
|
||||
|
||||
var create_table = document.createElement("td");
|
||||
create_table.align = "center";
|
||||
|
||||
var add_cols = document.createElement("td");
|
||||
add_cols.align = "center";
|
||||
|
||||
var remove_cols = document.createElement("td");
|
||||
remove_cols.align = "center";
|
||||
|
||||
var alter_cols = document.createElement("td");
|
||||
alter_cols.align = "center";
|
||||
|
||||
var add_index = document.createElement("td");
|
||||
add_index.align = "center";
|
||||
|
||||
var delete_index = document.createElement("td");
|
||||
delete_index.align = "center";
|
||||
|
||||
var update_rows = document.createElement("td");
|
||||
update_rows.align = "center";
|
||||
|
||||
var insert_rows = document.createElement("td");
|
||||
insert_rows.align = "center";
|
||||
|
||||
var tick_image = document.createElement("img");
|
||||
tick_image.src = pmaThemeImage + "s_success.png";
|
||||
|
||||
if (update_size == '' && insert_size == '' && remove_size == '') {
|
||||
/**
|
||||
This is the case when the table needs to be created in target database.
|
||||
*/
|
||||
create_table.appendChild(tick_image);
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = "--";
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else if (update_size == '' && remove_size == '') {
|
||||
/**
|
||||
This is the case when data difference is displayed in the
|
||||
table which is present in source but absent from target database
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = insert_size;
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else if (remove_size == '') {
|
||||
/**
|
||||
This is the case when data difference between matching_tables is displayed.
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = "--";
|
||||
remove_cols.innerHTML = "--";
|
||||
alter_cols.innerHTML = "--";
|
||||
add_index.innerHTML = "--";
|
||||
delete_index.innerHTML = "--";
|
||||
update_rows.innerHTML = update_size;
|
||||
insert_rows.innerHTML = insert_size;
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
|
||||
} else {
|
||||
/**
|
||||
This is the case when structure difference between matching_tables id displayed
|
||||
*/
|
||||
create_table.innerHTML = "--";
|
||||
add_cols.innerHTML = insert_size;
|
||||
remove_cols.innerHTML = remove_size;
|
||||
alter_cols.innerHTML = update_size;
|
||||
delete_index.innerHTML = remove_index;
|
||||
add_index.innerHTML = insert_index;
|
||||
update_rows.innerHTML = "--";
|
||||
insert_rows.innerHTML = "--";
|
||||
|
||||
newRow.appendChild(create_table);
|
||||
newRow.appendChild(add_cols);
|
||||
newRow.appendChild(remove_cols);
|
||||
newRow.appendChild(alter_cols);
|
||||
newRow.appendChild(delete_index);
|
||||
newRow.appendChild(add_index);
|
||||
newRow.appendChild(update_rows);
|
||||
newRow.appendChild(insert_rows);
|
||||
}
|
||||
table_body.appendChild(newRow);
|
||||
|
||||
} else {
|
||||
//The case when the row showing the details need to be removed from the table i.e. the difference button is deselected now.
|
||||
var table_rows = table_body.getElementsByTagName("tr");
|
||||
var j;
|
||||
var index = 0;
|
||||
for (j=0; j < table_rows.length; j++)
|
||||
{
|
||||
if (table_rows[j].id == i) {
|
||||
index = j;
|
||||
table_rows[j].parentNode.removeChild(table_rows[j]);
|
||||
}
|
||||
}
|
||||
//The table row css is being adjusted. Class "odd" for odd rows and "even" for even rows should be maintained.
|
||||
for(index = 0; index < table_rows.length; index++)
|
||||
{
|
||||
row_class_element = table_rows[index].getAttribute('class');
|
||||
if (row_class_element == "even") {
|
||||
table_rows[index].setAttribute("class","odd"); // for Mozilla firefox
|
||||
table_rows[index].className = "odd"; // for IE browser
|
||||
} else {
|
||||
table_rows[index].setAttribute("class","even"); // for Mozilla firefox
|
||||
table_rows[index].className = "even"; // for IE browser
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the URL containing the list of selected table ids for synchronization and
|
||||
* a variable checked for confirmation of deleting previous rows from target tables
|
||||
*
|
||||
* @param token the token generated for each PMA form
|
||||
*
|
||||
*/
|
||||
function ApplySelectedChanges(token)
|
||||
{
|
||||
var div = document.getElementById("list");
|
||||
var table = div.getElementsByTagName('table')[0];
|
||||
var table_body = table.getElementsByTagName('tbody')[0];
|
||||
// Get all the rows from the details table
|
||||
var table_rows = table_body.getElementsByTagName('tr');
|
||||
var x = table_rows.length;
|
||||
var i;
|
||||
/**
|
||||
Append the token at the beginning of the query string followed by
|
||||
Table_ids that shows that "Apply Selected Changes" button is pressed
|
||||
*/
|
||||
var append_string = "?token="+token+"&Table_ids="+1;
|
||||
for(i=0; i<x; i++){
|
||||
append_string += "&";
|
||||
append_string += i+"="+table_rows[i].id;
|
||||
}
|
||||
|
||||
// Getting the value of checkbox delete_rows
|
||||
var checkbox = document.getElementById("delete_rows");
|
||||
if (checkbox.checked){
|
||||
append_string += "&checked=true";
|
||||
} else {
|
||||
append_string += "&checked=false";
|
||||
}
|
||||
//Appending the token and list of table ids in the URL
|
||||
location.href += token;
|
||||
location.href += append_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an error message if any text field
|
||||
* is left empty other than the port field.
|
||||
*
|
||||
* @param string the form name
|
||||
* @param object the form
|
||||
*
|
||||
* @return boolean whether the form field is empty or not
|
||||
*/
|
||||
function validateConnection(form_name, form_obj)
|
||||
{
|
||||
var check = true;
|
||||
var src_hostfilled = true;
|
||||
var trg_hostfilled = true;
|
||||
|
||||
for (var i=1; i<form_name.elements.length; i++)
|
||||
{
|
||||
// All the text fields are checked excluding the port field because the default port can be used.
|
||||
if ((form_name.elements[i].type == 'text') && (form_name.elements[i].name != 'src_port') && (form_name.elements[i].name != 'trg_port')) {
|
||||
check = emptyFormElements(form_obj, form_name.elements[i].name);
|
||||
if (check==false) {
|
||||
element = form_name.elements[i].name;
|
||||
if (form_name.elements[i].name == 'src_host') {
|
||||
src_hostfilled = false;
|
||||
continue;
|
||||
}
|
||||
if (form_name.elements[i].name == 'trg_host') {
|
||||
trg_hostfilled = false;
|
||||
continue;
|
||||
}
|
||||
if ((form_name.elements[i].name == 'src_socket' && src_hostfilled==false) || (form_name.elements[i].name == 'trg_socket' && trg_hostfilled==false))
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!check) {
|
||||
form_obj.reset();
|
||||
element.select();
|
||||
alert(PMA_messages['strFormEmpty']);
|
||||
element.focus();
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.server_selector').change(function(evt) {
|
||||
var server = $(evt.target).val();
|
||||
@@ -23,5 +320,53 @@ $(document).ready(function() {
|
||||
$(this).closest('tbody').find('.server-pass').val('');
|
||||
$(this).closest('tbody').find('.server-db').val(parts[4])
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.struct_img').hover(
|
||||
// pmaThemeImage comes from js/messages.php
|
||||
function() {
|
||||
// mouse enters the element
|
||||
var $img = $(this);
|
||||
$img.addClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected_hovered.jpg');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_hovered.jpg');
|
||||
}
|
||||
},
|
||||
function() {
|
||||
// mouse leaves the element
|
||||
var $img = $(this);
|
||||
$img.removeClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct_selected.jpg');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_struct.jpg');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('.data_img').hover(
|
||||
function() {
|
||||
// mouse enters the element
|
||||
var $img = $(this);
|
||||
$img.addClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected_hovered.jpg');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_hovered.jpg');
|
||||
}
|
||||
},
|
||||
function() {
|
||||
// mouse leaves the element
|
||||
var $img = $(this);
|
||||
$img.removeClass('hover');
|
||||
if ($img.hasClass('selected')) {
|
||||
$img.attr('src', pmaThemeImage + 'new_data_selected.jpg');
|
||||
} else {
|
||||
$img.attr('src', pmaThemeImage + 'new_data.jpg');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
33
js/sql.js
33
js/sql.js
@@ -286,14 +286,21 @@ $(document).ready(function() {
|
||||
}
|
||||
else {
|
||||
// real results are returned
|
||||
$('#sqlqueryresults').show();
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$('#togglequerybox').show();
|
||||
if($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
$received_data = $(data);
|
||||
$zero_row_results = $received_data.find('textarea[name="sql_query"]');
|
||||
// if zero rows are returned from the query execution
|
||||
if ($zero_row_results.length > 0) {
|
||||
$('#sqlquery').val($zero_row_results.val());
|
||||
} else {
|
||||
$('#sqlqueryresults').show();
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$('#togglequerybox').show();
|
||||
if($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
}
|
||||
PMA_init_slider();
|
||||
}
|
||||
PMA_init_slider();
|
||||
}
|
||||
}) // end $.post()
|
||||
}) // end SQL Query submit
|
||||
@@ -998,10 +1005,14 @@ function PMA_changeClassForColumn($this_th, newclass) {
|
||||
var th_index = $this_th.index();
|
||||
// .eq() is zero-based
|
||||
th_index--;
|
||||
var $tr_with_data = $this_th.closest('table').find('tbody tr ').has('td.data');
|
||||
$tr_with_data.each(function() {
|
||||
$(this).find('td.data:eq('+th_index+')').toggleClass(newclass);
|
||||
});
|
||||
var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq('+th_index+')');
|
||||
if ($this_th.data('has_class_'+newclass)) {
|
||||
$tds.removeClass(newclass);
|
||||
$this_th.data('has_class_'+newclass, false);
|
||||
} else {
|
||||
$tds.addClass(newclass);
|
||||
$this_th.data('has_class_'+newclass, true);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -30,12 +30,6 @@
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +38,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel
|
||||
{
|
||||
@@ -628,7 +622,7 @@ class PHPExcel
|
||||
// then update cellXf indexes for cells
|
||||
foreach ($this->_workSheetCollection as $worksheet) {
|
||||
foreach ($worksheet->getCellCollection(false) as $cellID) {
|
||||
$cell = $sheet->getCell($cellID);
|
||||
$cell = $worksheet->getCell($cellID);
|
||||
$xfIndex = $cell->getXfIndex();
|
||||
if ($xfIndex > $pIndex ) {
|
||||
// decrease xf index by 1
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,11 +20,20 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
PHPExcel_Shared_String::buildCharacterSets();
|
||||
|
||||
|
||||
class PHPExcel_Autoloader
|
||||
{
|
||||
public static function Register() {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_CacheBase {
|
||||
|
||||
@@ -98,9 +98,7 @@ class PHPExcel_CachedObjectStorage_CacheBase {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateCacheData(PHPExcel_Cell $cell) {
|
||||
$pCoord = $cell->getCoordinate();
|
||||
|
||||
return $this->addCacheData($pCoord,$cell);
|
||||
return $this->addCacheData($cell->getCoordinate(),$cell);
|
||||
} // function updateCacheData()
|
||||
|
||||
|
||||
@@ -140,9 +138,9 @@ class PHPExcel_CachedObjectStorage_CacheBase {
|
||||
*/
|
||||
public function getSortedCellList() {
|
||||
$sortKeys = array();
|
||||
foreach ($this->_cellCache as $coord => $value) {
|
||||
list($colNum,$rowNum) = sscanf($coord,'%[A-Z]%d');
|
||||
$sortKeys[sprintf('%09d%3s',$rowNum,$colNum)] = $coord;
|
||||
foreach (array_keys($this->_cellCache) as $coord) {
|
||||
list($column,$row) = sscanf($coord,'%[A-Z]%d');
|
||||
$sortKeys[sprintf('%09d%3s',$row,$column)] = $coord;
|
||||
}
|
||||
ksort($sortKeys);
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
@@ -112,7 +112,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$newFileName = sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
|
||||
$newFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
|
||||
// Copy the existing cell cache file
|
||||
copy ($this->_fileName,$newFileName);
|
||||
$this->_fileName = $newFileName;
|
||||
@@ -140,7 +140,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
|
||||
parent::__construct($parent);
|
||||
if (is_null($this->_fileHandle)) {
|
||||
$baseUnique = $this->_getUniqueID();
|
||||
$this->_fileName = sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
|
||||
$this->_fileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
|
||||
$this->_fileHandle = fopen($this->_fileName,'a+');
|
||||
}
|
||||
} // function __construct()
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
@@ -234,6 +234,3 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage
|
||||
} // function __destruct()
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
@@ -68,6 +68,19 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent) {
|
||||
parent::copyCellCollection($parent);
|
||||
|
||||
$newCollection = array();
|
||||
foreach($this->_cellCache as $k => &$cell) {
|
||||
$newCollection[$k] = clone $cell;
|
||||
$newCollection[$k]->attach($parent);
|
||||
}
|
||||
|
||||
$this->_cellCache = $newCollection;
|
||||
}
|
||||
|
||||
|
||||
public function unsetWorksheetCells() {
|
||||
// Because cells are all stored as intact objects in memory, we need to detach each one from the parent
|
||||
foreach($this->_cellCache as $k => &$cell) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache {
|
||||
|
||||
@@ -228,6 +228,3 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage
|
||||
} // function __destruct()
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
384
libraries/PHPExcel/PHPExcel/Calculation/Database.php
Normal file
384
libraries/PHPExcel/PHPExcel/Calculation/Database.php
Normal file
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Database
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Database {
|
||||
|
||||
|
||||
private static function __fieldExtract($database,$field) {
|
||||
$field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field));
|
||||
$fieldNames = array_map('strtoupper',array_shift($database));
|
||||
|
||||
if (is_numeric($field)) {
|
||||
$keys = array_keys($fieldNames);
|
||||
return $keys[$field-1];
|
||||
}
|
||||
$key = array_search($field,$fieldNames);
|
||||
return ($key) ? $key : null;
|
||||
}
|
||||
|
||||
private static function __filter($database,$criteria) {
|
||||
$fieldNames = array_shift($database);
|
||||
$criteriaNames = array_shift($criteria);
|
||||
|
||||
// Convert the criteria into a set of AND/OR conditions with [:placeholders]
|
||||
$testConditions = $testValues = array();
|
||||
$testConditionsCount = 0;
|
||||
foreach($criteriaNames as $key => $criteriaName) {
|
||||
$testCondition = array();
|
||||
$testConditionCount = 0;
|
||||
foreach($criteria as $row => $criterion) {
|
||||
if ($criterion[$key] > '') {
|
||||
$testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::_ifCondition($criterion[$key]);
|
||||
$testConditionCount++;
|
||||
}
|
||||
}
|
||||
if ($testConditionCount > 1) {
|
||||
$testConditions[] = 'OR('.implode(',',$testCondition).')';
|
||||
$testConditionsCount++;
|
||||
} elseif($testConditionCount == 1) {
|
||||
$testConditions[] = $testCondition[0];
|
||||
$testConditionsCount++;
|
||||
}
|
||||
}
|
||||
if ($testConditionsCount > 1) {
|
||||
$testConditionSet = 'AND('.implode(',',$testConditions).')';
|
||||
} elseif($testConditionsCount == 1) {
|
||||
$testConditionSet = $testConditions[0];
|
||||
}
|
||||
|
||||
// Loop through each row of the database
|
||||
foreach($database as $dataRow => $dataValues) {
|
||||
// Substitute actual values from the database row for our [:placeholders]
|
||||
$testConditionList = $testConditionSet;
|
||||
foreach($criteriaNames as $key => $criteriaName) {
|
||||
$k = array_search($criteriaName,$fieldNames);
|
||||
if (isset($dataValues[$k])) {
|
||||
$dataValue = $dataValues[$k];
|
||||
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue;
|
||||
$testConditionList = str_replace('[:'.$criteriaName.']',$dataValue,$testConditionList);
|
||||
}
|
||||
}
|
||||
// evaluate the criteria against the row data
|
||||
$result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
|
||||
// If the row failed to meet the criteria, remove it from the database
|
||||
if (!$result) {
|
||||
unset($database[$dataRow]);
|
||||
}
|
||||
}
|
||||
|
||||
return $database;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DAVERAGE
|
||||
*
|
||||
*/
|
||||
public static function DAVERAGE($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::AVERAGE($colData);
|
||||
} // function DAVERAGE()
|
||||
|
||||
/**
|
||||
* DCOUNT
|
||||
*
|
||||
*/
|
||||
public static function DCOUNT($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::COUNT($colData);
|
||||
} // function DCOUNT()
|
||||
|
||||
/**
|
||||
* DCOUNTA
|
||||
*
|
||||
*/
|
||||
public static function DCOUNTA($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::COUNTA($colData);
|
||||
} // function DCOUNTA()
|
||||
|
||||
/**
|
||||
* DGET
|
||||
*
|
||||
*/
|
||||
public static function DGET($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
if (count($colData) > 1) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
return $colData[0];
|
||||
} // function DGET()
|
||||
|
||||
/**
|
||||
* DMAX
|
||||
*
|
||||
*/
|
||||
public static function DMAX($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::MAX($colData);
|
||||
} // function DMAX()
|
||||
|
||||
/**
|
||||
* DMIN
|
||||
*
|
||||
*/
|
||||
public static function DMIN($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::MIN($colData);
|
||||
} // function DMIN()
|
||||
|
||||
/**
|
||||
* DPRODUCT
|
||||
*
|
||||
*/
|
||||
public static function DPRODUCT($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_MathTrig::PRODUCT($colData);
|
||||
} // function DPRODUCT()
|
||||
|
||||
/**
|
||||
* DSTDEV
|
||||
*
|
||||
*/
|
||||
public static function DSTDEV($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::STDEV($colData);
|
||||
} // function DSTDEV()
|
||||
|
||||
/**
|
||||
* DSTDEVP
|
||||
*
|
||||
*/
|
||||
public static function DSTDEVP($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::STDEVP($colData);
|
||||
} // function DSTDEVP()
|
||||
|
||||
/**
|
||||
* DSUM
|
||||
*
|
||||
*/
|
||||
public static function DSUM($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_MathTrig::SUM($colData);
|
||||
} // function DSUM()
|
||||
|
||||
/**
|
||||
* DVAR
|
||||
*
|
||||
*/
|
||||
public static function DVAR($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::VARFunc($colData);
|
||||
} // function DVAR()
|
||||
|
||||
/**
|
||||
* DVARP
|
||||
*
|
||||
*/
|
||||
public static function DVARP($database,$field,$criteria) {
|
||||
$field = self::__fieldExtract($database,$field);
|
||||
if (is_null($field)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::__filter($database,$criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::VARP($colData);
|
||||
} // function DVARP()
|
||||
|
||||
|
||||
} // class PHPExcel_Calculation_Database
|
1178
libraries/PHPExcel/PHPExcel/Calculation/DateTime.php
Normal file
1178
libraries/PHPExcel/PHPExcel/Calculation/DateTime.php
Normal file
File diff suppressed because it is too large
Load Diff
2174
libraries/PHPExcel/PHPExcel/Calculation/Engineering.php
Normal file
2174
libraries/PHPExcel/PHPExcel/Calculation/Engineering.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Exception extends Exception {
|
||||
/**
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_ExceptionHandler {
|
||||
/**
|
||||
|
1818
libraries/PHPExcel/PHPExcel/Calculation/Financial.php
Normal file
1818
libraries/PHPExcel/PHPExcel/Calculation/Financial.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ PARTLY BASED ON:
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_FormulaParser {
|
||||
/* Character constants */
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ PARTLY BASED ON:
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_FormulaToken {
|
||||
/* Token types */
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Function {
|
||||
/* Function categories */
|
||||
|
File diff suppressed because it is too large
Load Diff
290
libraries/PHPExcel/PHPExcel/Calculation/Logical.php
Normal file
290
libraries/PHPExcel/PHPExcel/Calculation/Logical.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Logical
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_Logical {
|
||||
|
||||
/**
|
||||
* TRUE
|
||||
*
|
||||
* Returns the boolean TRUE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =TRUE()
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @return boolean True
|
||||
*/
|
||||
public static function TRUE() {
|
||||
return true;
|
||||
} // function TRUE()
|
||||
|
||||
|
||||
/**
|
||||
* FALSE
|
||||
*
|
||||
* Returns the boolean FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =FALSE()
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @return boolean False
|
||||
*/
|
||||
public static function FALSE() {
|
||||
return false;
|
||||
} // function FALSE()
|
||||
|
||||
|
||||
/**
|
||||
* LOGICAL_AND
|
||||
*
|
||||
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =AND(logical1[,logical2[, ...]])
|
||||
*
|
||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||
* or references that contain logical values.
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical AND of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_AND() {
|
||||
// Return value
|
||||
$returnValue = True;
|
||||
|
||||
// Loop through the arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
$argCount = 0;
|
||||
foreach ($aArgs as $arg) {
|
||||
// Is it a boolean value?
|
||||
if (is_bool($arg)) {
|
||||
$returnValue = $returnValue && $arg;
|
||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$returnValue = $returnValue && ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$returnValue = $returnValue && ($arg != 0);
|
||||
}
|
||||
++$argCount;
|
||||
}
|
||||
|
||||
// Return
|
||||
if ($argCount == 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return $returnValue;
|
||||
} // function LOGICAL_AND()
|
||||
|
||||
|
||||
/**
|
||||
* LOGICAL_OR
|
||||
*
|
||||
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =OR(logical1[,logical2[, ...]])
|
||||
*
|
||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||
* or references that contain logical values.
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical OR of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_OR() {
|
||||
// Return value
|
||||
$returnValue = False;
|
||||
|
||||
// Loop through the arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
$argCount = 0;
|
||||
foreach ($aArgs as $arg) {
|
||||
// Is it a boolean value?
|
||||
if (is_bool($arg)) {
|
||||
$returnValue = $returnValue || $arg;
|
||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$returnValue = $returnValue || ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$returnValue = $returnValue || ($arg != 0);
|
||||
}
|
||||
++$argCount;
|
||||
}
|
||||
|
||||
// Return
|
||||
if ($argCount == 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return $returnValue;
|
||||
} // function LOGICAL_OR()
|
||||
|
||||
|
||||
/**
|
||||
* NOT
|
||||
*
|
||||
* Returns the boolean inverse of the argument.
|
||||
*
|
||||
* Excel Function:
|
||||
* =NOT(logical)
|
||||
*
|
||||
* The argument must evaluate to a logical value such as TRUE or FALSE
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
||||
* @return boolean The boolean inverse of the argument.
|
||||
*/
|
||||
public static function NOT($logical) {
|
||||
$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
|
||||
if (is_string($logical)) {
|
||||
$logical = strtoupper($logical);
|
||||
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
||||
return false;
|
||||
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
||||
return true;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
}
|
||||
|
||||
return !$logical;
|
||||
} // function NOT()
|
||||
|
||||
/**
|
||||
* STATEMENT_IF
|
||||
*
|
||||
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =IF(condition[,returnIfTrue[,returnIfFalse]])
|
||||
*
|
||||
* Condition is any value or expression that can be evaluated to TRUE or FALSE.
|
||||
* For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
|
||||
* the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
|
||||
* This argument can use any comparison calculation operator.
|
||||
* ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
|
||||
* For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
|
||||
* then the IF function returns the text "Within budget"
|
||||
* If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
|
||||
* the logical value TRUE for this argument.
|
||||
* ReturnIfTrue can be another formula.
|
||||
* ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
|
||||
* For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
|
||||
* then the IF function returns the text "Over budget".
|
||||
* If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
|
||||
* If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
|
||||
* ReturnIfFalse can be another formula.
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $condition Condition to evaluate
|
||||
* @param mixed $returnIfTrue Value to return when condition is true
|
||||
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||
*/
|
||||
public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = False) {
|
||||
$condition = (is_null($condition)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
|
||||
$returnIfFalse = (is_null($returnIfFalse)) ? False : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
|
||||
|
||||
return ($condition ? $returnIfTrue : $returnIfFalse);
|
||||
} // function STATEMENT_IF()
|
||||
|
||||
|
||||
/**
|
||||
* IFERROR
|
||||
*
|
||||
* Excel Function:
|
||||
* =IFERROR(testValue,errorpart)
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $testValue Value to check, is also the value returned when no error
|
||||
* @param mixed $errorpart Value to return when testValue is an error condition
|
||||
* @return mixed The value of errorpart or testValue determined by error condition
|
||||
*/
|
||||
public static function IFERROR($testValue = '', $errorpart = '') {
|
||||
$testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||
$errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
|
||||
|
||||
return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
|
||||
} // function IFERROR()
|
||||
|
||||
} // class PHPExcel_Calculation_Logical
|
746
libraries/PHPExcel/PHPExcel/Calculation/LookupRef.php
Normal file
746
libraries/PHPExcel/PHPExcel/Calculation/LookupRef.php
Normal file
@@ -0,0 +1,746 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_LookupRef
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_LookupRef {
|
||||
|
||||
|
||||
/**
|
||||
* CELL_ADDRESS
|
||||
*
|
||||
* Creates a cell address as text, given specified row and column numbers.
|
||||
*
|
||||
* @param row Row number to use in the cell reference
|
||||
* @param column Column number to use in the cell reference
|
||||
* @param relativity Flag indicating the type of reference to return
|
||||
* 1 or omitted Absolute
|
||||
* 2 Absolute row; relative column
|
||||
* 3 Relative row; absolute column
|
||||
* 4 Relative
|
||||
* @param referenceStyle A logical value that specifies the A1 or R1C1 reference style.
|
||||
* TRUE or omitted CELL_ADDRESS returns an A1-style reference
|
||||
* FALSE CELL_ADDRESS returns an R1C1-style reference
|
||||
* @param sheetText Optional Name of worksheet to use
|
||||
* @return string
|
||||
*/
|
||||
public static function CELL_ADDRESS($row, $column, $relativity=1, $referenceStyle=True, $sheetText='') {
|
||||
$row = PHPExcel_Calculation_Functions::flattenSingleValue($row);
|
||||
$column = PHPExcel_Calculation_Functions::flattenSingleValue($column);
|
||||
$relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
|
||||
$sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
|
||||
|
||||
if (($row < 1) || ($column < 1)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if ($sheetText > '') {
|
||||
if (strpos($sheetText,' ') !== False) { $sheetText = "'".$sheetText."'"; }
|
||||
$sheetText .='!';
|
||||
}
|
||||
if ((!is_bool($referenceStyle)) || $referenceStyle) {
|
||||
$rowRelative = $columnRelative = '$';
|
||||
$column = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
if (($relativity == 2) || ($relativity == 4)) { $columnRelative = ''; }
|
||||
if (($relativity == 3) || ($relativity == 4)) { $rowRelative = ''; }
|
||||
return $sheetText.$columnRelative.$column.$rowRelative.$row;
|
||||
} else {
|
||||
if (($relativity == 2) || ($relativity == 4)) { $column = '['.$column.']'; }
|
||||
if (($relativity == 3) || ($relativity == 4)) { $row = '['.$row.']'; }
|
||||
return $sheetText.'R'.$row.'C'.$column;
|
||||
}
|
||||
} // function CELL_ADDRESS()
|
||||
|
||||
|
||||
/**
|
||||
* COLUMN
|
||||
*
|
||||
* Returns the column number of the given cell reference
|
||||
* If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
|
||||
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||
* reference of the cell in which the COLUMN function appears; otherwise this function returns 0.
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the column numbers
|
||||
* @return integer or array of integer
|
||||
*/
|
||||
public static function COLUMN($cellAddress=Null) {
|
||||
if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; }
|
||||
|
||||
if (is_array($cellAddress)) {
|
||||
foreach($cellAddress as $columnKey => $value) {
|
||||
$columnKey = preg_replace('/[^a-z]/i','',$columnKey);
|
||||
return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress,'!') !== false) {
|
||||
list($sheet,$cellAddress) = explode('!',$cellAddress);
|
||||
}
|
||||
if (strpos($cellAddress,':') !== false) {
|
||||
list($startAddress,$endAddress) = explode(':',$cellAddress);
|
||||
$startAddress = preg_replace('/[^a-z]/i','',$startAddress);
|
||||
$endAddress = preg_replace('/[^a-z]/i','',$endAddress);
|
||||
$returnValue = array();
|
||||
do {
|
||||
$returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
|
||||
} while ($startAddress++ != $endAddress);
|
||||
return $returnValue;
|
||||
} else {
|
||||
$cellAddress = preg_replace('/[^a-z]/i','',$cellAddress);
|
||||
return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress);
|
||||
}
|
||||
}
|
||||
} // function COLUMN()
|
||||
|
||||
|
||||
/**
|
||||
* COLUMNS
|
||||
*
|
||||
* Returns the number of columns in an array or reference.
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns
|
||||
* @return integer
|
||||
*/
|
||||
public static function COLUMNS($cellAddress=Null) {
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return 1;
|
||||
} elseif (!is_array($cellAddress)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
$x = array_keys($cellAddress);
|
||||
$x = array_shift($x);
|
||||
$isMatrix = (is_numeric($x));
|
||||
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $rows;
|
||||
} else {
|
||||
return $columns;
|
||||
}
|
||||
} // function COLUMNS()
|
||||
|
||||
|
||||
/**
|
||||
* ROW
|
||||
*
|
||||
* Returns the row number of the given cell reference
|
||||
* If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
|
||||
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||
* reference of the cell in which the ROW function appears; otherwise this function returns 0.
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the row numbers
|
||||
* @return integer or array of integer
|
||||
*/
|
||||
public static function ROW($cellAddress=Null) {
|
||||
if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; }
|
||||
|
||||
if (is_array($cellAddress)) {
|
||||
foreach($cellAddress as $columnKey => $rowValue) {
|
||||
foreach($rowValue as $rowKey => $cellValue) {
|
||||
return (integer) preg_replace('/[^0-9]/i','',$rowKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress,'!') !== false) {
|
||||
list($sheet,$cellAddress) = explode('!',$cellAddress);
|
||||
}
|
||||
if (strpos($cellAddress,':') !== false) {
|
||||
list($startAddress,$endAddress) = explode(':',$cellAddress);
|
||||
$startAddress = preg_replace('/[^0-9]/','',$startAddress);
|
||||
$endAddress = preg_replace('/[^0-9]/','',$endAddress);
|
||||
$returnValue = array();
|
||||
do {
|
||||
$returnValue[][] = (integer) $startAddress;
|
||||
} while ($startAddress++ != $endAddress);
|
||||
return $returnValue;
|
||||
} else {
|
||||
list($cellAddress) = explode(':',$cellAddress);
|
||||
return (integer) preg_replace('/[^0-9]/','',$cellAddress);
|
||||
}
|
||||
}
|
||||
} // function ROW()
|
||||
|
||||
|
||||
/**
|
||||
* ROWS
|
||||
*
|
||||
* Returns the number of rows in an array or reference.
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||
* @return integer
|
||||
*/
|
||||
public static function ROWS($cellAddress=Null) {
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return 1;
|
||||
} elseif (!is_array($cellAddress)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
$i = array_keys($cellAddress);
|
||||
$isMatrix = (is_numeric(array_shift($i)));
|
||||
list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $columns;
|
||||
} else {
|
||||
return $rows;
|
||||
}
|
||||
} // function ROWS()
|
||||
|
||||
|
||||
/**
|
||||
* HYPERLINK
|
||||
*
|
||||
* Excel Function:
|
||||
* =HYPERLINK(linkURL,displayName)
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param string $linkURL Value to check, is also the value returned when no error
|
||||
* @param string $displayName Value to return when testValue is an error condition
|
||||
* @return mixed The value of errorpart or testValue determined by error condition
|
||||
*/
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) {
|
||||
$args = func_get_args();
|
||||
$pCell = array_pop($args);
|
||||
|
||||
$linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
|
||||
$displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
|
||||
|
||||
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
if ((is_object($displayName)) || trim($displayName) == '') {
|
||||
$displayName = $linkURL;
|
||||
}
|
||||
|
||||
$pCell->getHyperlink()->setUrl($linkURL);
|
||||
|
||||
return $displayName;
|
||||
} // function HYPERLINK()
|
||||
|
||||
|
||||
/**
|
||||
* INDIRECT
|
||||
*
|
||||
* Returns the number of rows in an array or reference.
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||
* @return integer
|
||||
*/
|
||||
public static function INDIRECT($cellAddress=Null, PHPExcel_Cell $pCell = null) {
|
||||
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$cellAddress1 = $cellAddress;
|
||||
$cellAddress2 = NULL;
|
||||
if (strpos($cellAddress,':') !== false) {
|
||||
list($cellAddress1,$cellAddress2) = explode(':',$cellAddress);
|
||||
}
|
||||
|
||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
||||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
if (strpos($cellAddress,'!') !== false) {
|
||||
list($sheetName,$cellAddress) = explode('!',$cellAddress);
|
||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getParent();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||
} // function INDIRECT()
|
||||
|
||||
|
||||
/**
|
||||
* OFFSET
|
||||
*
|
||||
* Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
|
||||
* The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
|
||||
* the number of columns to be returned.
|
||||
*
|
||||
* @param cellAddress The reference from which you want to base the offset. Reference must refer to a cell or
|
||||
* range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
|
||||
* @param rows The number of rows, up or down, that you want the upper-left cell to refer to.
|
||||
* Using 5 as the rows argument specifies that the upper-left cell in the reference is
|
||||
* five rows below reference. Rows can be positive (which means below the starting reference)
|
||||
* or negative (which means above the starting reference).
|
||||
* @param cols The number of columns, to the left or right, that you want the upper-left cell of the result
|
||||
* to refer to. Using 5 as the cols argument specifies that the upper-left cell in the
|
||||
* reference is five columns to the right of reference. Cols can be positive (which means
|
||||
* to the right of the starting reference) or negative (which means to the left of the
|
||||
* starting reference).
|
||||
* @param height The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
|
||||
* @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
|
||||
* @return string A reference to a cell or range of cells
|
||||
*/
|
||||
public static function OFFSET($cellAddress=Null,$rows=0,$columns=0,$height=null,$width=null) {
|
||||
$rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
|
||||
$columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
|
||||
$height = PHPExcel_Calculation_Functions::flattenSingleValue($height);
|
||||
$width = PHPExcel_Calculation_Functions::flattenSingleValue($width);
|
||||
if ($cellAddress == Null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$args = func_get_args();
|
||||
$pCell = array_pop($args);
|
||||
if (!is_object($pCell)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$sheetName = null;
|
||||
if (strpos($cellAddress,"!")) {
|
||||
list($sheetName,$cellAddress) = explode("!",$cellAddress);
|
||||
}
|
||||
if (strpos($cellAddress,":")) {
|
||||
list($startCell,$endCell) = explode(":",$cellAddress);
|
||||
} else {
|
||||
$startCell = $endCell = $cellAddress;
|
||||
}
|
||||
list($startCellColumn,$startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
|
||||
list($endCellColumn,$endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
|
||||
|
||||
$startCellRow += $rows;
|
||||
$startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
|
||||
$startCellColumn += $columns;
|
||||
|
||||
if (($startCellRow <= 0) || ($startCellColumn < 0)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
|
||||
if (($width != null) && (!is_object($width))) {
|
||||
$endCellColumn = $startCellColumn + $width - 1;
|
||||
} else {
|
||||
$endCellColumn += $columns;
|
||||
}
|
||||
$startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
|
||||
|
||||
if (($height != null) && (!is_object($height))) {
|
||||
$endCellRow = $startCellRow + $height - 1;
|
||||
} else {
|
||||
$endCellRow += $rows;
|
||||
}
|
||||
|
||||
if (($endCellRow <= 0) || ($endCellColumn < 0)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
|
||||
|
||||
$cellAddress = $startCellColumn.$startCellRow;
|
||||
if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
|
||||
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
||||
}
|
||||
|
||||
if ($sheetName !== null) {
|
||||
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getParent();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
|
||||
} // function OFFSET()
|
||||
|
||||
|
||||
public static function CHOOSE() {
|
||||
$chooseArgs = func_get_args();
|
||||
$chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
|
||||
$entryCount = count($chooseArgs) - 1;
|
||||
|
||||
if(is_array($chosenEntry)) {
|
||||
$chosenEntry = array_shift($chosenEntry);
|
||||
}
|
||||
if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
|
||||
--$chosenEntry;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$chosenEntry = floor($chosenEntry);
|
||||
if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_array($chooseArgs[$chosenEntry])) {
|
||||
return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
|
||||
} else {
|
||||
return $chooseArgs[$chosenEntry];
|
||||
}
|
||||
} // function CHOOSE()
|
||||
|
||||
|
||||
/**
|
||||
* MATCH
|
||||
*
|
||||
* The MATCH function searches for a specified item in a range of cells
|
||||
*
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
|
||||
* @return integer The relative position of the found item
|
||||
*/
|
||||
public static function MATCH($lookup_value, $lookup_array, $match_type=1) {
|
||||
$lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
|
||||
// MATCH is not case sensitive
|
||||
$lookup_value = strtolower($lookup_value);
|
||||
|
||||
// lookup_value type has to be number, text, or logical values
|
||||
if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// match_type is 0, 1 or -1
|
||||
if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// lookup_array should not be empty
|
||||
$lookupArraySize = count($lookup_array);
|
||||
if ($lookupArraySize <= 0) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// lookup_array should contain only number, text, or logical values, or empty (null) cells
|
||||
foreach($lookup_array as $i => $lookupArrayValue) {
|
||||
// check the type of the value
|
||||
if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
|
||||
(!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
// convert strings to lowercase for case-insensitive testing
|
||||
if (is_string($lookupArrayValue)) {
|
||||
$lookup_array[$i] = strtolower($lookupArrayValue);
|
||||
}
|
||||
if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
|
||||
$lookup_array = array_slice($lookup_array,0,$i-1);
|
||||
}
|
||||
}
|
||||
|
||||
// if match_type is 1 or -1, the list has to be ordered
|
||||
if ($match_type == 1) {
|
||||
asort($lookup_array);
|
||||
$keySet = array_keys($lookup_array);
|
||||
} elseif($match_type == -1) {
|
||||
arsort($lookup_array);
|
||||
$keySet = array_keys($lookup_array);
|
||||
}
|
||||
|
||||
// **
|
||||
// find the match
|
||||
// **
|
||||
// loop on the cells
|
||||
// var_dump($lookup_array);
|
||||
// echo '<br />';
|
||||
foreach($lookup_array as $i => $lookupArrayValue) {
|
||||
if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) {
|
||||
// exact match
|
||||
return ++$i;
|
||||
} elseif (($match_type == -1) && ($lookupArrayValue <= $lookup_value)) {
|
||||
// echo '$i = '.$i.' => ';
|
||||
// var_dump($lookupArrayValue);
|
||||
// echo '<br />';
|
||||
// echo 'Keyset = ';
|
||||
// var_dump($keySet);
|
||||
// echo '<br />';
|
||||
$i = array_search($i,$keySet);
|
||||
// echo '$i='.$i.'<br />';
|
||||
// if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value
|
||||
if ($i < 1){
|
||||
// 1st cell was allready smaller than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
// the previous cell was the match
|
||||
return $keySet[$i-1]+1;
|
||||
}
|
||||
} elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
|
||||
// echo '$i = '.$i.' => ';
|
||||
// var_dump($lookupArrayValue);
|
||||
// echo '<br />';
|
||||
// echo 'Keyset = ';
|
||||
// var_dump($keySet);
|
||||
// echo '<br />';
|
||||
$i = array_search($i,$keySet);
|
||||
// echo '$i='.$i.'<br />';
|
||||
// if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
|
||||
if ($i < 1){
|
||||
// 1st cell was allready bigger than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
// the previous cell was the match
|
||||
return $keySet[$i-1]+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsuccessful in finding a match, return #N/A error value
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} // function MATCH()
|
||||
|
||||
|
||||
/**
|
||||
* INDEX
|
||||
*
|
||||
* Uses an index to choose a value from a reference or array
|
||||
* implemented: Return the value of a specified cell or array of cells Array form
|
||||
* not implemented: Return a reference to specified cells Reference form
|
||||
*
|
||||
* @param range_array a range of cells or an array constant
|
||||
* @param row_num selects the row in array from which to return a value. If row_num is omitted, column_num is required.
|
||||
* @param column_num selects the column in array from which to return a value. If column_num is omitted, row_num is required.
|
||||
*/
|
||||
public static function INDEX($arrayValues,$rowNum = 0,$columnNum = 0) {
|
||||
|
||||
if (($rowNum < 0) || ($columnNum < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (!is_array($arrayValues)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$rowKeys = array_keys($arrayValues);
|
||||
$columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
|
||||
|
||||
if ($columnNum > count($columnKeys)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} elseif ($columnNum == 0) {
|
||||
if ($rowNum == 0) {
|
||||
return $arrayValues;
|
||||
}
|
||||
$rowNum = $rowKeys[--$rowNum];
|
||||
$returnArray = array();
|
||||
foreach($arrayValues as $arrayColumn) {
|
||||
if (is_array($arrayColumn)) {
|
||||
if (isset($arrayColumn[$rowNum])) {
|
||||
$returnArray[] = $arrayColumn[$rowNum];
|
||||
} else {
|
||||
return $arrayValues[$rowNum];
|
||||
}
|
||||
} else {
|
||||
return $arrayValues[$rowNum];
|
||||
}
|
||||
}
|
||||
return $returnArray;
|
||||
}
|
||||
$columnNum = $columnKeys[--$columnNum];
|
||||
if ($rowNum > count($rowKeys)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} elseif ($rowNum == 0) {
|
||||
return $arrayValues[$columnNum];
|
||||
}
|
||||
$rowNum = $rowKeys[--$rowNum];
|
||||
|
||||
return $arrayValues[$rowNum][$columnNum];
|
||||
} // function INDEX()
|
||||
|
||||
|
||||
/**
|
||||
* TRANSPOSE
|
||||
*
|
||||
* @param array $matrixData A matrix of values
|
||||
* @return array
|
||||
*
|
||||
* Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
|
||||
*/
|
||||
public static function TRANSPOSE($matrixData) {
|
||||
$returnMatrix = array();
|
||||
if (!is_array($matrixData)) { $matrixData = array(array($matrixData)); }
|
||||
|
||||
$column = 0;
|
||||
foreach($matrixData as $matrixRow) {
|
||||
$row = 0;
|
||||
foreach($matrixRow as $matrixCell) {
|
||||
$returnMatrix[$row][$column] = $matrixCell;
|
||||
++$row;
|
||||
}
|
||||
++$column;
|
||||
}
|
||||
return $returnMatrix;
|
||||
} // function TRANSPOSE()
|
||||
|
||||
|
||||
private static function _vlookupSort($a,$b) {
|
||||
$f = array_keys($a);
|
||||
$firstColumn = array_shift($f);
|
||||
if (strtolower($a[$firstColumn]) == strtolower($b[$firstColumn])) {
|
||||
return 0;
|
||||
}
|
||||
return (strtolower($a[$firstColumn]) < strtolower($b[$firstColumn])) ? -1 : 1;
|
||||
} // function _vlookupSort()
|
||||
|
||||
|
||||
/**
|
||||
* VLOOKUP
|
||||
* The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The column number in table_array from which the matching value must be returned. The first column is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) {
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||
|
||||
// index_number must be greater than or equal to 1
|
||||
if ($index_number < 1) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (count($lookup_array) < 1)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$returnColumn = $columnKeys[--$index_number];
|
||||
$firstColumn = array_shift($columnKeys);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
uasort($lookup_array,array('self','_vlookupSort'));
|
||||
}
|
||||
|
||||
$rowNumber = $rowValue = False;
|
||||
foreach($lookup_array as $rowKey => $rowData) {
|
||||
if (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)) {
|
||||
break;
|
||||
}
|
||||
$rowNumber = $rowKey;
|
||||
$rowValue = $rowData[$firstColumn];
|
||||
}
|
||||
|
||||
if ($rowNumber !== false) {
|
||||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} else {
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$rowNumber][$returnColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} // function VLOOKUP()
|
||||
|
||||
|
||||
/**
|
||||
* LOOKUP
|
||||
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_vector The range of cells being searched
|
||||
* @param result_vector The column from which the matching value must be returned
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function LOOKUP($lookup_value, $lookup_vector, $result_vector=null) {
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
|
||||
if (!is_array($lookup_vector)) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
$lookupRows = count($lookup_vector);
|
||||
$l = array_keys($lookup_vector);
|
||||
$l = array_shift($l);
|
||||
$lookupColumns = count($lookup_vector[$l]);
|
||||
if ((($lookupRows == 1) && ($lookupColumns > 1)) || (($lookupRows == 2) && ($lookupColumns != 2))) {
|
||||
$lookup_vector = self::TRANSPOSE($lookup_vector);
|
||||
$lookupRows = count($lookup_vector);
|
||||
$l = array_keys($lookup_vector);
|
||||
$lookupColumns = count($lookup_vector[array_shift($l)]);
|
||||
}
|
||||
|
||||
if (is_null($result_vector)) {
|
||||
$result_vector = $lookup_vector;
|
||||
}
|
||||
$resultRows = count($result_vector);
|
||||
$l = array_keys($result_vector);
|
||||
$l = array_shift($l);
|
||||
$resultColumns = count($result_vector[$l]);
|
||||
if ((($resultRows == 1) && ($resultColumns > 1)) || (($resultRows == 2) && ($resultColumns != 2))) {
|
||||
$result_vector = self::TRANSPOSE($result_vector);
|
||||
$resultRows = count($result_vector);
|
||||
$r = array_keys($result_vector);
|
||||
$resultColumns = count($result_vector[array_shift($r)]);
|
||||
}
|
||||
|
||||
if ($lookupRows == 2) {
|
||||
$result_vector = array_pop($lookup_vector);
|
||||
$lookup_vector = array_shift($lookup_vector);
|
||||
}
|
||||
if ($lookupColumns != 2) {
|
||||
foreach($lookup_vector as &$value) {
|
||||
if (is_array($value)) {
|
||||
$k = array_keys($value);
|
||||
$key1 = $key2 = array_shift($k);
|
||||
$key2++;
|
||||
$dataValue1 = $value[$key1];
|
||||
} else {
|
||||
$key1 = 0;
|
||||
$key2 = 1;
|
||||
$dataValue1 = $value;
|
||||
}
|
||||
$dataValue2 = array_shift($result_vector);
|
||||
if (is_array($dataValue2)) {
|
||||
$dataValue2 = array_shift($dataValue2);
|
||||
}
|
||||
$value = array($key1 => $dataValue1, $key2 => $dataValue2);
|
||||
}
|
||||
unset($value);
|
||||
}
|
||||
|
||||
return self::VLOOKUP($lookup_value,$lookup_vector,2);
|
||||
} // function LOOKUP()
|
||||
|
||||
} // class PHPExcel_Calculation_LookupRef
|
1241
libraries/PHPExcel/PHPExcel/Calculation/MathTrig.php
Normal file
1241
libraries/PHPExcel/PHPExcel/Calculation/MathTrig.php
Normal file
File diff suppressed because it is too large
Load Diff
3643
libraries/PHPExcel/PHPExcel/Calculation/Statistical.php
Normal file
3643
libraries/PHPExcel/PHPExcel/Calculation/Statistical.php
Normal file
File diff suppressed because it is too large
Load Diff
588
libraries/PHPExcel/PHPExcel/Calculation/TextData.php
Normal file
588
libraries/PHPExcel/PHPExcel/Calculation/TextData.php
Normal file
@@ -0,0 +1,588 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_TextData
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Calculation_TextData {
|
||||
|
||||
private static $_invalidChars = Null;
|
||||
|
||||
private static function _uniord($c) {
|
||||
if (ord($c{0}) >=0 && ord($c{0}) <= 127)
|
||||
return ord($c{0});
|
||||
if (ord($c{0}) >= 192 && ord($c{0}) <= 223)
|
||||
return (ord($c{0})-192)*64 + (ord($c{1})-128);
|
||||
if (ord($c{0}) >= 224 && ord($c{0}) <= 239)
|
||||
return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
|
||||
if (ord($c{0}) >= 240 && ord($c{0}) <= 247)
|
||||
return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
|
||||
if (ord($c{0}) >= 248 && ord($c{0}) <= 251)
|
||||
return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
|
||||
if (ord($c{0}) >= 252 && ord($c{0}) <= 253)
|
||||
return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
|
||||
if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
return 0;
|
||||
} // function _uniord()
|
||||
|
||||
/**
|
||||
* CHARACTER
|
||||
*
|
||||
* @param string $character Value
|
||||
* @return int
|
||||
*/
|
||||
public static function CHARACTER($character) {
|
||||
$character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
|
||||
|
||||
if ((!is_numeric($character)) || ($character < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
|
||||
} else {
|
||||
return chr(intval($character));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TRIMNONPRINTABLE
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMNONPRINTABLE($stringValue = '') {
|
||||
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||
|
||||
if (is_bool($stringValue)) {
|
||||
$stringValue = ($stringValue) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (self::$_invalidChars == Null) {
|
||||
self::$_invalidChars = range(chr(0),chr(31));
|
||||
}
|
||||
|
||||
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||
return str_replace(self::$_invalidChars,'',trim($stringValue,"\x00..\x1F"));
|
||||
}
|
||||
return Null;
|
||||
} // function TRIMNONPRINTABLE()
|
||||
|
||||
|
||||
/**
|
||||
* TRIMSPACES
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMSPACES($stringValue = '') {
|
||||
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||
|
||||
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||
return trim(preg_replace('/ +/',' ',$stringValue));
|
||||
}
|
||||
return Null;
|
||||
} // function TRIMSPACES()
|
||||
|
||||
|
||||
/**
|
||||
* ASCIICODE
|
||||
*
|
||||
* @param string $character Value
|
||||
* @return int
|
||||
*/
|
||||
public static function ASCIICODE($characters) {
|
||||
$characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
|
||||
if (is_bool($characters)) {
|
||||
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$characters = (int) $characters;
|
||||
} else {
|
||||
if ($characters) {
|
||||
$characters = 'True';
|
||||
} else {
|
||||
$characters = 'False';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$character = $characters;
|
||||
if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
|
||||
if (mb_strlen($characters, 'UTF-8') > 1) { $character = mb_substr($characters, 0, 1, 'UTF-8'); }
|
||||
return self::_uniord($character);
|
||||
} else {
|
||||
if (strlen($characters) > 0) { $character = substr($characters, 0, 1); }
|
||||
return ord($character);
|
||||
}
|
||||
} // function ASCIICODE()
|
||||
|
||||
|
||||
/**
|
||||
* CONCATENATE
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function CONCATENATE() {
|
||||
// Return value
|
||||
$returnValue = '';
|
||||
|
||||
// Loop through arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
foreach ($aArgs as $arg) {
|
||||
if (is_bool($arg)) {
|
||||
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$arg = (int) $arg;
|
||||
} else {
|
||||
if ($arg) {
|
||||
$arg = 'TRUE';
|
||||
} else {
|
||||
$arg = 'FALSE';
|
||||
}
|
||||
}
|
||||
}
|
||||
$returnValue .= $arg;
|
||||
}
|
||||
|
||||
// Return
|
||||
return $returnValue;
|
||||
} // function CONCATENATE()
|
||||
|
||||
|
||||
/**
|
||||
* DOLLAR
|
||||
*
|
||||
* This function converts a number to text using currency format, with the decimals rounded to the specified place.
|
||||
* The format used is $#,##0.00_);($#,##0.00)..
|
||||
*
|
||||
* @param float $value The value to format
|
||||
* @param int $decimals The number of digits to display to the right of the decimal point.
|
||||
* If decimals is negative, number is rounded to the left of the decimal point.
|
||||
* If you omit decimals, it is assumed to be 2
|
||||
* @return string
|
||||
*/
|
||||
public static function DOLLAR($value = 0, $decimals = 2) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||
|
||||
// Validate parameters
|
||||
if (!is_numeric($value) || !is_numeric($decimals)) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
$decimals = floor($decimals);
|
||||
|
||||
if ($decimals > 0) {
|
||||
return money_format('%.'.$decimals.'n',$value);
|
||||
} else {
|
||||
$round = pow(10,abs($decimals));
|
||||
if ($value < 0) { $round = 0-$round; }
|
||||
$value = PHPExcel_Calculation_MathTrig::MROUND($value,$round);
|
||||
// The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0,
|
||||
// so we display to 1 dp and chop off that character and the decimal separator using substr
|
||||
return substr(money_format('%.1n',$value),0,-2);
|
||||
}
|
||||
} // function DOLLAR()
|
||||
|
||||
|
||||
/**
|
||||
* SEARCHSENSITIVE
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHSENSITIVE($needle,$haystack,$offset=1) {
|
||||
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||
|
||||
if (!is_bool($needle)) {
|
||||
if (is_bool($haystack)) {
|
||||
$haystack = ($haystack) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (($offset > 0) && (strlen($haystack) > $offset)) {
|
||||
if (function_exists('mb_strpos')) {
|
||||
$pos = mb_strpos($haystack, $needle, --$offset,'UTF-8');
|
||||
} else {
|
||||
$pos = strpos($haystack, $needle, --$offset);
|
||||
}
|
||||
if ($pos !== false) {
|
||||
return ++$pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} // function SEARCHSENSITIVE()
|
||||
|
||||
|
||||
/**
|
||||
* SEARCHINSENSITIVE
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHINSENSITIVE($needle,$haystack,$offset=1) {
|
||||
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||
|
||||
if (!is_bool($needle)) {
|
||||
if (is_bool($haystack)) {
|
||||
$haystack = ($haystack) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (($offset > 0) && (strlen($haystack) > $offset)) {
|
||||
if (function_exists('mb_stripos')) {
|
||||
$pos = mb_stripos($haystack, $needle, --$offset,'UTF-8');
|
||||
} else {
|
||||
$pos = stripos($haystack, $needle, --$offset);
|
||||
}
|
||||
if ($pos !== false) {
|
||||
return ++$pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} // function SEARCHINSENSITIVE()
|
||||
|
||||
|
||||
/**
|
||||
* FIXEDFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function FIXEDFORMAT($value,$decimals=2,$no_commas=false) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||
$no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
|
||||
|
||||
$valueResult = round($value,$decimals);
|
||||
if ($decimals < 0) { $decimals = 0; }
|
||||
if (!$no_commas) {
|
||||
$valueResult = number_format($valueResult,$decimals);
|
||||
}
|
||||
|
||||
return (string) $valueResult;
|
||||
} // function FIXEDFORMAT()
|
||||
|
||||
|
||||
/**
|
||||
* LEFT
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function LEFT($value = '', $chars = 1) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if ($chars < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, 0, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, 0, $chars);
|
||||
}
|
||||
} // function LEFT()
|
||||
|
||||
|
||||
/**
|
||||
* MID
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function MID($value = '', $start = 1, $chars = null) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if (($start < 1) || ($chars < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, --$start, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, --$start, $chars);
|
||||
}
|
||||
} // function MID()
|
||||
|
||||
|
||||
/**
|
||||
* RIGHT
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function RIGHT($value = '', $chars = 1) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if ($chars < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
|
||||
return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, strlen($value) - $chars);
|
||||
}
|
||||
} // function RIGHT()
|
||||
|
||||
|
||||
/**
|
||||
* STRINGLENGTH
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function STRINGLENGTH($value = '') {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($value, 'UTF-8');
|
||||
} else {
|
||||
return strlen($value);
|
||||
}
|
||||
} // function STRINGLENGTH()
|
||||
|
||||
|
||||
/**
|
||||
* LOWERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function LOWERCASE($mixedCaseString) {
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
} // function LOWERCASE()
|
||||
|
||||
|
||||
/**
|
||||
* UPPERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function UPPERCASE($mixedCaseString) {
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
} // function UPPERCASE()
|
||||
|
||||
|
||||
/**
|
||||
* PROPERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function PROPERCASE($mixedCaseString) {
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8');
|
||||
} else {
|
||||
return ucwords($mixedCaseString);
|
||||
}
|
||||
} // function PROPERCASE()
|
||||
|
||||
|
||||
/**
|
||||
* REPLACE
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) {
|
||||
$oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
|
||||
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
$newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
|
||||
|
||||
$left = self::LEFT($oldText,$start-1);
|
||||
$right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1);
|
||||
|
||||
return $left.$newText.$right;
|
||||
} // function REPLACE()
|
||||
|
||||
|
||||
/**
|
||||
* SUBSTITUTE
|
||||
*
|
||||
* @param string $text Value
|
||||
* @param string $fromText From Value
|
||||
* @param string $toText To Value
|
||||
* @param integer $instance Instance Number
|
||||
* @return string
|
||||
*/
|
||||
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) {
|
||||
$text = PHPExcel_Calculation_Functions::flattenSingleValue($text);
|
||||
$fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
|
||||
$toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
|
||||
$instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
|
||||
|
||||
if ($instance == 0) {
|
||||
if(function_exists('mb_str_replace')) {
|
||||
return mb_str_replace($fromText,$toText,$text);
|
||||
} else {
|
||||
return str_replace($fromText,$toText,$text);
|
||||
}
|
||||
} else {
|
||||
$pos = -1;
|
||||
while($instance > 0) {
|
||||
if (function_exists('mb_strpos')) {
|
||||
$pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
|
||||
} else {
|
||||
$pos = strpos($text, $fromText, $pos+1);
|
||||
}
|
||||
if ($pos === false) {
|
||||
break;
|
||||
}
|
||||
--$instance;
|
||||
}
|
||||
if ($pos !== false) {
|
||||
if (function_exists('mb_strlen')) {
|
||||
return self::REPLACE($text,++$pos,mb_strlen($fromText, 'UTF-8'),$toText);
|
||||
} else {
|
||||
return self::REPLACE($text,++$pos,strlen($fromText),$toText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $left.$newText.$right;
|
||||
} // function SUBSTITUTE()
|
||||
|
||||
|
||||
/**
|
||||
* RETURNSTRING
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function RETURNSTRING($testValue = '') {
|
||||
$testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||
|
||||
if (is_string($testValue)) {
|
||||
return $testValue;
|
||||
}
|
||||
return Null;
|
||||
} // function RETURNSTRING()
|
||||
|
||||
|
||||
/**
|
||||
* TEXTFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function TEXTFORMAT($value,$format) {
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
|
||||
|
||||
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
|
||||
$value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
|
||||
}
|
||||
|
||||
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format);
|
||||
} // function TEXTFORMAT()
|
||||
|
||||
} // class PHPExcel_Calculation_TextData
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell
|
||||
{
|
||||
@@ -140,7 +140,9 @@ class PHPExcel_Cell
|
||||
$this->_parent = $pSheet;
|
||||
|
||||
// Set datatype?
|
||||
if (!is_null($pDataType)) {
|
||||
if ($pDataType !== null) {
|
||||
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2)
|
||||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
$this->_dataType = $pDataType;
|
||||
} else {
|
||||
if (!self::getValueBinder()->bindValue($this, $pValue)) {
|
||||
@@ -192,6 +194,18 @@ class PHPExcel_Cell
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell value with formatting
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormattedValue()
|
||||
{
|
||||
return PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(),
|
||||
$this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cell value
|
||||
*
|
||||
@@ -220,6 +234,8 @@ class PHPExcel_Cell
|
||||
{
|
||||
// set the value according to data type
|
||||
switch ($pDataType) {
|
||||
case PHPExcel_Cell_DataType::TYPE_STRING2:
|
||||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
case PHPExcel_Cell_DataType::TYPE_STRING:
|
||||
case PHPExcel_Cell_DataType::TYPE_NULL:
|
||||
case PHPExcel_Cell_DataType::TYPE_INLINE:
|
||||
@@ -280,10 +296,10 @@ class PHPExcel_Cell
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (is_null($this->_value)) {
|
||||
// if (is_null($this->_value)) {
|
||||
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
|
||||
return null;
|
||||
}
|
||||
// return null;
|
||||
// }
|
||||
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
|
||||
return $this->_value;
|
||||
}
|
||||
@@ -331,6 +347,9 @@ class PHPExcel_Cell
|
||||
*/
|
||||
public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
|
||||
{
|
||||
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2)
|
||||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
|
||||
$this->_dataType = $pDataType;
|
||||
|
||||
return $this->notifyCacheController();
|
||||
@@ -461,7 +480,7 @@ class PHPExcel_Cell
|
||||
list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange);
|
||||
|
||||
// Translate properties
|
||||
$myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()) - 1;
|
||||
$myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn());
|
||||
$myRow = $this->getRow();
|
||||
|
||||
// Verify if cell is in range
|
||||
@@ -479,23 +498,44 @@ class PHPExcel_Cell
|
||||
*/
|
||||
public static function coordinateFromString($pCoordinateString = 'A1')
|
||||
{
|
||||
if (strpos($pCoordinateString,':') !== false) {
|
||||
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) {
|
||||
return array($matches[1],$matches[2]);
|
||||
} elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) {
|
||||
throw new Exception('Cell coordinate string can not be a range of cells.');
|
||||
} else if ($pCoordinateString == '') {
|
||||
} elseif ($pCoordinateString == '') {
|
||||
throw new Exception('Cell coordinate can not be zero-length string.');
|
||||
} else if (preg_match("/([$]?[A-Z]+)([$]?\d+)/", $pCoordinateString, $matches)) {
|
||||
list(, $column, $row) = $matches;
|
||||
return array($column, $row);
|
||||
} else {
|
||||
throw new Exception('Invalid cell coordinate.');
|
||||
throw new Exception('Invalid cell coordinate '.$pCoordinateString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make string row, column or cell coordinate absolute
|
||||
*
|
||||
* @param string $pCoordinateString e.g. 'A' or '1' or 'A1'
|
||||
* @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1'
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function absoluteReference($pCoordinateString = 'A1')
|
||||
{
|
||||
if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
|
||||
// Create absolute coordinate
|
||||
if (ctype_digit($pCoordinateString)) {
|
||||
return '$'.$pCoordinateString;
|
||||
} elseif (ctype_alpha($pCoordinateString)) {
|
||||
return '$'.strtoupper($pCoordinateString);
|
||||
}
|
||||
return self::absoluteCoordinate($pCoordinateString);
|
||||
} else {
|
||||
throw new Exception("Coordinate string should not be a cell range.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make string coordinate absolute
|
||||
*
|
||||
* @param string $pCoordinateString
|
||||
* @return string Absolute coordinate
|
||||
* @param string $pCoordinateString e.g. 'A1'
|
||||
* @return string Absolute coordinate e.g. '$A$1'
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function absoluteCoordinate($pCoordinateString = 'A1')
|
||||
@@ -503,6 +543,8 @@ class PHPExcel_Cell
|
||||
if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
|
||||
// Create absolute coordinate
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString);
|
||||
if ($column[0] == '$') $column = substr($column,1);
|
||||
if ($row[0] == '$') $row = substr($row,1);
|
||||
return '$' . $column . '$' . $row;
|
||||
} else {
|
||||
throw new Exception("Coordinate string should not be a cell range.");
|
||||
@@ -518,7 +560,8 @@ class PHPExcel_Cell
|
||||
public static function splitRange($pRange = 'A1:A1')
|
||||
{
|
||||
$exploded = explode(',', $pRange);
|
||||
for ($i = 0; $i < count($exploded); ++$i) {
|
||||
$counter = count($exploded);
|
||||
for ($i = 0; $i < $counter; ++$i) {
|
||||
$exploded[$i] = explode(':', $exploded[$i]);
|
||||
}
|
||||
return $exploded;
|
||||
@@ -540,7 +583,8 @@ class PHPExcel_Cell
|
||||
|
||||
// Build range
|
||||
$imploded = array();
|
||||
for ($i = 0; $i < count($pRange); ++$i) {
|
||||
$counter = count($pRange);
|
||||
for ($i = 0; $i < $counter; ++$i) {
|
||||
$pRange[$i] = implode(':', $pRange[$i]);
|
||||
}
|
||||
$imploded = implode(',', $pRange);
|
||||
@@ -604,8 +648,7 @@ class PHPExcel_Cell
|
||||
|
||||
// Extract range
|
||||
if (strpos($pRange, ':') === false) {
|
||||
$rangeA = $pRange;
|
||||
$rangeB = $pRange;
|
||||
$rangeA = $rangeB = $pRange;
|
||||
} else {
|
||||
list($rangeA, $rangeB) = explode(':', $pRange);
|
||||
}
|
||||
@@ -622,28 +665,28 @@ class PHPExcel_Cell
|
||||
*/
|
||||
public static function columnIndexFromString($pString = 'A')
|
||||
{
|
||||
static $lookup = array(
|
||||
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
|
||||
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
|
||||
// memory overhead either
|
||||
static $_columnLookup = array(
|
||||
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13,
|
||||
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26
|
||||
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26,
|
||||
'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13,
|
||||
'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26
|
||||
);
|
||||
|
||||
if (isset($lookup[$pString]))
|
||||
return $lookup[$pString];
|
||||
|
||||
// Convert to uppercase
|
||||
$pString = strtoupper($pString);
|
||||
|
||||
$strLen = strlen($pString);
|
||||
// Convert column to integer
|
||||
if ($strLen == 1) {
|
||||
return (ord($pString{0}) - 64);
|
||||
} elseif ($strLen == 2) {
|
||||
return $result = ((1 + (ord($pString{0}) - 65)) * 26) + (ord($pString{1}) - 64);
|
||||
} elseif ($strLen == 3) {
|
||||
return ((1 + (ord($pString{0}) - 65)) * 676) + ((1 + (ord($pString{1}) - 65)) * 26) + (ord($pString{2}) - 64);
|
||||
} else {
|
||||
throw new Exception("Column string index can not be " . ($strLen != 0 ? "longer than 3 characters" : "empty") . ".");
|
||||
// We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
|
||||
// for improved performance
|
||||
if (isset($pString{0})) {
|
||||
if (!isset($pString{1})) {
|
||||
return $_columnLookup[$pString];
|
||||
} elseif(!isset($pString{2})) {
|
||||
return $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
|
||||
} elseif(!isset($pString{3})) {
|
||||
return $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
|
||||
}
|
||||
}
|
||||
throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty") . ".");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -657,8 +700,10 @@ class PHPExcel_Cell
|
||||
// Determine column string
|
||||
if ($pColumnIndex < 26) {
|
||||
return chr(65 + $pColumnIndex);
|
||||
} elseif ($pColumnIndex < 702) {
|
||||
return chr(64 + ($pColumnIndex / 26)).chr(65 + $pColumnIndex % 26);
|
||||
}
|
||||
return PHPExcel_Cell::stringFromColumnIndex((int)($pColumnIndex / 26) -1).chr(65 + $pColumnIndex%26) ;
|
||||
return chr(64 + (($pColumnIndex - 26) / 676)).chr(65 + ((($pColumnIndex - 26) % 676) / 26)).chr(65 + $pColumnIndex % 26);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -672,60 +717,41 @@ class PHPExcel_Cell
|
||||
$returnValue = array();
|
||||
|
||||
// Explode spaces
|
||||
$aExplodeSpaces = explode(' ', str_replace('$', '', strtoupper($pRange)));
|
||||
foreach ($aExplodeSpaces as $explodedSpaces) {
|
||||
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange)));
|
||||
foreach ($cellBlocks as $cellBlock) {
|
||||
// Single cell?
|
||||
if (strpos($explodedSpaces,':') === false && strpos($explodedSpaces,',') === false) {
|
||||
$col = 'A';
|
||||
$row = 1;
|
||||
list($col, $row) = PHPExcel_Cell::coordinateFromString($explodedSpaces);
|
||||
|
||||
if (strlen($col) <= 2) {
|
||||
$returnValue[] = $explodedSpaces;
|
||||
}
|
||||
|
||||
if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) {
|
||||
$returnValue[] = $cellBlock;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Range...
|
||||
$range = PHPExcel_Cell::splitRange($explodedSpaces);
|
||||
for ($i = 0; $i < count($range); ++$i) {
|
||||
$ranges = PHPExcel_Cell::splitRange($cellBlock);
|
||||
foreach($ranges as $range) {
|
||||
// Single cell?
|
||||
if (count($range[$i]) == 1) {
|
||||
$col = 'A';
|
||||
$row = 1;
|
||||
list($col, $row) = PHPExcel_Cell::coordinateFromString($range[$i]);
|
||||
|
||||
if (strlen($col) <= 2) {
|
||||
$returnValue[] = $explodedSpaces;
|
||||
}
|
||||
if (!isset($range[1])) {
|
||||
$returnValue[] = $range[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Range...
|
||||
$rangeStart = $rangeEnd = '';
|
||||
$startingCol = $startingRow = $endingCol = $endingRow = 0;
|
||||
|
||||
list($rangeStart, $rangeEnd) = $range[$i];
|
||||
list($startingCol, $startingRow) = PHPExcel_Cell::coordinateFromString($rangeStart);
|
||||
list($endingCol, $endingRow) = PHPExcel_Cell::coordinateFromString($rangeEnd);
|
||||
|
||||
// Conversions...
|
||||
$startingCol = PHPExcel_Cell::columnIndexFromString($startingCol);
|
||||
$endingCol = PHPExcel_Cell::columnIndexFromString($endingCol);
|
||||
list($rangeStart, $rangeEnd) = $range;
|
||||
list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d');
|
||||
list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d');
|
||||
$endCol++;
|
||||
|
||||
// Current data
|
||||
$currentCol = --$startingCol;
|
||||
$currentRow = $startingRow;
|
||||
$currentCol = $startCol;
|
||||
$currentRow = $startRow;
|
||||
|
||||
// Loop cells
|
||||
while ($currentCol < $endingCol) {
|
||||
$loopColumn = PHPExcel_Cell::stringFromColumnIndex($currentCol);
|
||||
while ($currentRow <= $endingRow) {
|
||||
$returnValue[] = $loopColumn.$currentRow;
|
||||
while ($currentCol != $endCol) {
|
||||
while ($currentRow <= $endRow) {
|
||||
$returnValue[] = $currentCol.$currentRow;
|
||||
++$currentRow;
|
||||
}
|
||||
++$currentCol;
|
||||
$currentRow = $startingRow;
|
||||
$currentRow = $startRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,18 +20,28 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_AdvancedValueBinder
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
@@ -54,14 +64,27 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||
|
||||
// Style logic - strings
|
||||
if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
|
||||
// Test for booleans using locale-setting
|
||||
if ($value == PHPExcel_Calculation::getTRUE()) {
|
||||
$cell->setValueExplicit( True, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||
return true;
|
||||
} elseif($value == PHPExcel_Calculation::getFALSE()) {
|
||||
$cell->setValueExplicit( False, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for number in scientific format
|
||||
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
|
||||
$cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for percentage
|
||||
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit( (float)str_replace('%', '', $value) / 100, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,13 +92,10 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
|
||||
list($h, $m) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440;
|
||||
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -83,29 +103,24 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
|
||||
list($h, $m, $s) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440 + $s / 86400;
|
||||
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
|
||||
if (($v = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||
// Convert value to Excel date
|
||||
$cell->setValueExplicit($v, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
|
||||
// Set style. Either there is a time part or not. Look for ':'
|
||||
if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Determine style. Either there is a time part or not. Look for ':'
|
||||
if (strpos($value, ':') !== false) {
|
||||
$formatCode = 'yyyy-mm-dd h:mm';
|
||||
} else {
|
||||
$formatCode = 'yyyy-mm-dd';
|
||||
}
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode($formatCode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -113,10 +128,8 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
||||
if (strpos($value, "\n") !== false) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
|
||||
// Set style
|
||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getAlignment()->setWrapText(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DataType
|
||||
{
|
||||
/* Data types */
|
||||
const TYPE_STRING2 = 'str';
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DataValidation
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,18 +20,28 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_DefaultValueBinder
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Cell_Hyperlink
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
{
|
||||
@@ -91,6 +91,13 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*/
|
||||
private $_fillColor;
|
||||
|
||||
/**
|
||||
* Alignment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_alignment;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Comment
|
||||
*
|
||||
@@ -99,9 +106,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise variables
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,6 +261,26 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
return $this->_fillColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Alignment
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Alignment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAlignment() {
|
||||
return $this->_alignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
@@ -268,6 +296,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
. $this->_marginTop
|
||||
. ($this->_visible ? 1 : 0)
|
||||
. $this->_fillColor->getHashCode()
|
||||
. $this->_alignment
|
||||
. __CLASS__
|
||||
);
|
||||
}
|
||||
|
@@ -1,354 +1,465 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_DocumentProperties
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_DocumentProperties
|
||||
{
|
||||
/** constants */
|
||||
const PROPERTY_TYPE_BOOLEAN = 'b';
|
||||
const PROPERTY_TYPE_INTEGER = 'i';
|
||||
const PROPERTY_TYPE_FLOAT = 'f';
|
||||
const PROPERTY_TYPE_DATE = 'd';
|
||||
const PROPERTY_TYPE_STRING = 's';
|
||||
const PROPERTY_TYPE_UNKNOWN = 'u';
|
||||
|
||||
|
||||
/**
|
||||
* Creator
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_creator;
|
||||
private $_creator = 'Unknown Creator';
|
||||
|
||||
/**
|
||||
* LastModifiedBy
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_lastModifiedBy;
|
||||
|
||||
/**
|
||||
* Created
|
||||
*
|
||||
* @var datetime
|
||||
* @var datetime
|
||||
*/
|
||||
private $_created;
|
||||
|
||||
/**
|
||||
* Modified
|
||||
*
|
||||
* @var datetime
|
||||
* @var datetime
|
||||
*/
|
||||
private $_modified;
|
||||
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_title;
|
||||
private $_title = 'Untitled Spreadsheet';
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_description;
|
||||
private $_description = '';
|
||||
|
||||
/**
|
||||
* Subject
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_subject;
|
||||
private $_subject = '';
|
||||
|
||||
/**
|
||||
* Keywords
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_keywords;
|
||||
private $_keywords = '';
|
||||
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_category;
|
||||
private $_category = '';
|
||||
|
||||
/**
|
||||
* Manager
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_manager = '';
|
||||
|
||||
/**
|
||||
* Company
|
||||
*
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private $_company;
|
||||
private $_company = 'Microsoft Corporation';
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_creator = 'Unknown Creator';
|
||||
$this->_lastModifiedBy = $this->_creator;
|
||||
$this->_created = time();
|
||||
$this->_modified = time();
|
||||
$this->_title = "Untitled Spreadsheet";
|
||||
$this->_subject = '';
|
||||
$this->_description = '';
|
||||
$this->_keywords = '';
|
||||
$this->_category = '';
|
||||
$this->_manager = '';
|
||||
$this->_company = 'Microsoft Corporation';
|
||||
}
|
||||
/**
|
||||
* Custom Properties
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_customProperties = array();
|
||||
|
||||
/**
|
||||
* Get Creator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreator() {
|
||||
return $this->_creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Creator
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreator($pValue = '') {
|
||||
$this->_creator = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Create a new PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise values
|
||||
$this->_lastModifiedBy = $this->_creator;
|
||||
$this->_created = time();
|
||||
$this->_modified = time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Last Modified By
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastModifiedBy() {
|
||||
return $this->_lastModifiedBy;
|
||||
}
|
||||
/**
|
||||
* Get Creator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreator() {
|
||||
return $this->_creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Last Modified By
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setLastModifiedBy($pValue = '') {
|
||||
$this->_lastModifiedBy = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Creator
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreator($pValue = '') {
|
||||
$this->_creator = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Created
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreated() {
|
||||
return $this->_created;
|
||||
}
|
||||
/**
|
||||
* Get Last Modified By
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastModifiedBy() {
|
||||
return $this->_lastModifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Created
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreated($pValue = null) {
|
||||
if (is_null($pValue)) {
|
||||
$pValue = time();
|
||||
}
|
||||
$this->_created = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Last Modified By
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setLastModifiedBy($pValue = '') {
|
||||
$this->_lastModifiedBy = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Modified
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getModified() {
|
||||
return $this->_modified;
|
||||
}
|
||||
/**
|
||||
* Get Created
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getCreated() {
|
||||
return $this->_created;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Modified
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setModified($pValue = null) {
|
||||
if (is_null($pValue)) {
|
||||
$pValue = time();
|
||||
}
|
||||
$this->_modified = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Created
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCreated($pValue = null) {
|
||||
if (is_null($pValue)) {
|
||||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->_title;
|
||||
}
|
||||
$this->_created = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Title
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setTitle($pValue = '') {
|
||||
$this->_title = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Get Modified
|
||||
*
|
||||
* @return datetime
|
||||
*/
|
||||
public function getModified() {
|
||||
return $this->_modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->_description;
|
||||
}
|
||||
/**
|
||||
* Set Modified
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setModified($pValue = null) {
|
||||
if (is_null($pValue)) {
|
||||
$pValue = time();
|
||||
} elseif (is_string($pValue)) {
|
||||
if (is_numeric($pValue)) {
|
||||
$pValue = intval($pValue);
|
||||
} else {
|
||||
$pValue = strtotime($pValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Description
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setDescription($pValue = '') {
|
||||
$this->_description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
$this->_modified = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubject() {
|
||||
return $this->_subject;
|
||||
}
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Subject
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setSubject($pValue = '') {
|
||||
$this->_subject = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Title
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setTitle($pValue = '') {
|
||||
$this->_title = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Keywords
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeywords() {
|
||||
return $this->_keywords;
|
||||
}
|
||||
/**
|
||||
* Get Description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Keywords
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setKeywords($pValue = '') {
|
||||
$this->_keywords = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Description
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setDescription($pValue = '') {
|
||||
$this->_description = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Category
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->_category;
|
||||
}
|
||||
/**
|
||||
* Get Subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubject() {
|
||||
return $this->_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Category
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCategory($pValue = '') {
|
||||
$this->_category = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Subject
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setSubject($pValue = '') {
|
||||
$this->_subject = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Company
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany() {
|
||||
return $this->_company;
|
||||
}
|
||||
/**
|
||||
* Get Keywords
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeywords() {
|
||||
return $this->_keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Company
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCompany($pValue = '') {
|
||||
$this->_company = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Keywords
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setKeywords($pValue = '') {
|
||||
$this->_keywords = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getManager() {
|
||||
return $this->_manager;
|
||||
}
|
||||
/**
|
||||
* Get Category
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory() {
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Manager
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setManager($pValue = '') {
|
||||
$this->_manager = $pValue;
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Set Category
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCategory($pValue = '') {
|
||||
$this->_category = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Company
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCompany() {
|
||||
return $this->_company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Company
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCompany($pValue = '') {
|
||||
$this->_company = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getManager() {
|
||||
return $this->_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Manager
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setManager($pValue = '') {
|
||||
$this->_manager = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a List of Custom Property Names
|
||||
*
|
||||
* @return array of string
|
||||
*/
|
||||
public function getCustomProperties() {
|
||||
return array_keys($this->_customProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Custom Property is defined
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return boolean
|
||||
*/
|
||||
public function isCustomPropertySet($propertyName) {
|
||||
return isset($this->_customProperties[$propertyName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Value
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyValue($propertyName) {
|
||||
if (isset($this->_customProperties[$propertyName])) {
|
||||
return $this->_customProperties[$propertyName]['value'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Custom Property Type
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomPropertyType($propertyName) {
|
||||
if (isset($this->_customProperties[$propertyName])) {
|
||||
return $this->_customProperties[$propertyName]['type'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a Custom Property
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param mixed $propertyValue
|
||||
* @param string $propertyType
|
||||
* 'i' : Integer
|
||||
* 'f' : Floating Point
|
||||
* 's' : String
|
||||
* 'd' : Date/Time
|
||||
* 'b' : Boolean
|
||||
* @return PHPExcel_DocumentProperties
|
||||
*/
|
||||
public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) {
|
||||
if ((is_null($propertyType)) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER,
|
||||
self::PROPERTY_TYPE_FLOAT,
|
||||
self::PROPERTY_TYPE_STRING,
|
||||
self::PROPERTY_TYPE_DATE,
|
||||
self::PROPERTY_TYPE_BOOLEAN)))) {
|
||||
if (is_null($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
} elseif (is_float($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_FLOAT;
|
||||
} elseif(is_int($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_INTEGER;
|
||||
} elseif (is_bool($propertyValue)) {
|
||||
$propertyType = self::PROPERTY_TYPE_BOOLEAN;
|
||||
} else {
|
||||
$propertyType = self::PROPERTY_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
@@ -363,4 +474,115 @@ class PHPExcel_DocumentProperties
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function convertProperty($propertyValue,$propertyType) {
|
||||
switch ($propertyType) {
|
||||
case 'empty' : // Empty
|
||||
return '';
|
||||
break;
|
||||
case 'null' : // Null
|
||||
return NULL;
|
||||
break;
|
||||
case 'i1' : // 1-Byte Signed Integer
|
||||
case 'i2' : // 2-Byte Signed Integer
|
||||
case 'i4' : // 4-Byte Signed Integer
|
||||
case 'i8' : // 8-Byte Signed Integer
|
||||
case 'int' : // Integer
|
||||
return (int) $propertyValue;
|
||||
break;
|
||||
case 'ui1' : // 1-Byte Unsigned Integer
|
||||
case 'ui2' : // 2-Byte Unsigned Integer
|
||||
case 'ui4' : // 4-Byte Unsigned Integer
|
||||
case 'ui8' : // 8-Byte Unsigned Integer
|
||||
case 'uint' : // Unsigned Integer
|
||||
return abs((int) $propertyValue);
|
||||
break;
|
||||
case 'r4' : // 4-Byte Real Number
|
||||
case 'r8' : // 8-Byte Real Number
|
||||
case 'decimal' : // Decimal
|
||||
return (float) $propertyValue;
|
||||
break;
|
||||
case 'lpstr' : // LPSTR
|
||||
case 'lpwstr' : // LPWSTR
|
||||
case 'bstr' : // Basic String
|
||||
return $propertyValue;
|
||||
break;
|
||||
case 'date' : // Date and Time
|
||||
case 'filetime' : // File Time
|
||||
return strtotime($propertyValue);
|
||||
break;
|
||||
case 'bool' : // Boolean
|
||||
return ($propertyValue == 'true') ? True : False;
|
||||
break;
|
||||
case 'cy' : // Currency
|
||||
case 'error' : // Error Status Code
|
||||
case 'vector' : // Vector
|
||||
case 'array' : // Array
|
||||
case 'blob' : // Binary Blob
|
||||
case 'oblob' : // Binary Blob Object
|
||||
case 'stream' : // Binary Stream
|
||||
case 'ostream' : // Binary Stream Object
|
||||
case 'storage' : // Binary Storage
|
||||
case 'ostorage' : // Binary Storage Object
|
||||
case 'vstream' : // Binary Versioned Stream
|
||||
case 'clsid' : // Class ID
|
||||
case 'cf' : // Clipboard Data
|
||||
return $propertyValue;
|
||||
break;
|
||||
}
|
||||
return $propertyValue;
|
||||
}
|
||||
|
||||
public static function convertPropertyType($propertyType) {
|
||||
switch ($propertyType) {
|
||||
case 'i1' : // 1-Byte Signed Integer
|
||||
case 'i2' : // 2-Byte Signed Integer
|
||||
case 'i4' : // 4-Byte Signed Integer
|
||||
case 'i8' : // 8-Byte Signed Integer
|
||||
case 'int' : // Integer
|
||||
case 'ui1' : // 1-Byte Unsigned Integer
|
||||
case 'ui2' : // 2-Byte Unsigned Integer
|
||||
case 'ui4' : // 4-Byte Unsigned Integer
|
||||
case 'ui8' : // 8-Byte Unsigned Integer
|
||||
case 'uint' : // Unsigned Integer
|
||||
return self::PROPERTY_TYPE_INTEGER;
|
||||
break;
|
||||
case 'r4' : // 4-Byte Real Number
|
||||
case 'r8' : // 8-Byte Real Number
|
||||
case 'decimal' : // Decimal
|
||||
return self::PROPERTY_TYPE_FLOAT;
|
||||
break;
|
||||
case 'empty' : // Empty
|
||||
case 'null' : // Null
|
||||
case 'lpstr' : // LPSTR
|
||||
case 'lpwstr' : // LPWSTR
|
||||
case 'bstr' : // Basic String
|
||||
return self::PROPERTY_TYPE_STRING;
|
||||
break;
|
||||
case 'date' : // Date and Time
|
||||
case 'filetime' : // File Time
|
||||
return self::PROPERTY_TYPE_DATE;
|
||||
break;
|
||||
case 'bool' : // Boolean
|
||||
return self::PROPERTY_TYPE_BOOLEAN;
|
||||
break;
|
||||
case 'cy' : // Currency
|
||||
case 'error' : // Error Status Code
|
||||
case 'vector' : // Vector
|
||||
case 'array' : // Array
|
||||
case 'blob' : // Binary Blob
|
||||
case 'oblob' : // Binary Blob Object
|
||||
case 'stream' : // Binary Stream
|
||||
case 'ostream' : // Binary Stream Object
|
||||
case 'storage' : // Binary Storage
|
||||
case 'ostorage' : // Binary Storage Object
|
||||
case 'vstream' : // Binary Versioned Stream
|
||||
case 'clsid' : // Class ID
|
||||
case 'cf' : // Clipboard Data
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
return self::PROPERTY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_DocumentSecurity
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,10 +19,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -30,161 +30,163 @@
|
||||
* PHPExcel_HashTable
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_HashTable
|
||||
{
|
||||
/**
|
||||
* HashTable elements
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_items = array();
|
||||
/**
|
||||
* HashTable elements
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_items = array();
|
||||
|
||||
/**
|
||||
* HashTable key map
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_keyMap = array();
|
||||
/**
|
||||
* HashTable key map
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_keyMap = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_HashTable
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
{
|
||||
if (!is_null($pSource)) {
|
||||
// Create HashTable
|
||||
$this->addFromSource($pSource);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a new PHPExcel_HashTable
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
{
|
||||
if (!is_null($pSource)) {
|
||||
// Create HashTable
|
||||
$this->addFromSource($pSource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HashTable items from source
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null) {
|
||||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
return;
|
||||
} else if (!is_array($pSource)) {
|
||||
throw new Exception('Invalid array parameter passed.');
|
||||
}
|
||||
/**
|
||||
* Add HashTable items from source
|
||||
*
|
||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null) {
|
||||
// Check if an array was passed
|
||||
if ($pSource == null) {
|
||||
return;
|
||||
} else if (!is_array($pSource)) {
|
||||
throw new Exception('Invalid array parameter passed.');
|
||||
}
|
||||
|
||||
foreach ($pSource as $item) {
|
||||
$this->add($item);
|
||||
}
|
||||
}
|
||||
foreach ($pSource as $item) {
|
||||
$this->add($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to add
|
||||
* @throws Exception
|
||||
*/
|
||||
public function add(PHPExcel_IComparable $pSource = null) {
|
||||
if (!isset($this->_items[ $pSource->getHashCode() ])) {
|
||||
$this->_items[ $pSource->getHashCode() ] = $pSource;
|
||||
$this->_keyMap[ count($this->_items) - 1 ] = $pSource->getHashCode();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to add
|
||||
* @throws Exception
|
||||
*/
|
||||
public function add(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
if (!isset($this->_items[$hash])) {
|
||||
$this->_items[$hash] = $pSource;
|
||||
$this->_keyMap[count($this->_items) - 1] = $hash;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to remove
|
||||
* @throws Exception
|
||||
*/
|
||||
public function remove(PHPExcel_IComparable $pSource = null) {
|
||||
if (isset($this->_items[ $pSource->getHashCode() ])) {
|
||||
unset($this->_items[ $pSource->getHashCode() ]);
|
||||
/**
|
||||
* Remove HashTable item
|
||||
*
|
||||
* @param PHPExcel_IComparable $pSource Item to remove
|
||||
* @throws Exception
|
||||
*/
|
||||
public function remove(PHPExcel_IComparable $pSource = null) {
|
||||
$hash = $pSource->getHashCode();
|
||||
if (isset($this->_items[$hash])) {
|
||||
unset($this->_items[$hash]);
|
||||
|
||||
$deleteKey = -1;
|
||||
foreach ($this->_keyMap as $key => $value) {
|
||||
if ($deleteKey >= 0) {
|
||||
$this->_keyMap[$key - 1] = $value;
|
||||
}
|
||||
$deleteKey = -1;
|
||||
foreach ($this->_keyMap as $key => $value) {
|
||||
if ($deleteKey >= 0) {
|
||||
$this->_keyMap[$key - 1] = $value;
|
||||
}
|
||||
|
||||
if ($value == $pSource->getHashCode()) {
|
||||
$deleteKey = $key;
|
||||
}
|
||||
}
|
||||
unset($this->_keyMap[ count($this->_keyMap) - 1 ]);
|
||||
}
|
||||
}
|
||||
if ($value == $hash) {
|
||||
$deleteKey = $key;
|
||||
}
|
||||
}
|
||||
unset($this->_keyMap[count($this->_keyMap) - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear HashTable
|
||||
*
|
||||
*/
|
||||
public function clear() {
|
||||
$this->_items = array();
|
||||
$this->_keyMap = array();
|
||||
}
|
||||
/**
|
||||
* Clear HashTable
|
||||
*
|
||||
*/
|
||||
public function clear() {
|
||||
$this->_items = array();
|
||||
$this->_keyMap = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->_items);
|
||||
}
|
||||
/**
|
||||
* Count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->_items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index for hash code
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return int Index
|
||||
*/
|
||||
public function getIndexForHashCode($pHashCode = '') {
|
||||
return array_search($pHashCode, $this->_keyMap);
|
||||
}
|
||||
/**
|
||||
* Get index for hash code
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return int Index
|
||||
*/
|
||||
public function getIndexForHashCode($pHashCode = '') {
|
||||
return array_search($pHashCode, $this->_keyMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by index
|
||||
*
|
||||
* @param int $pIndex
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByIndex($pIndex = 0) {
|
||||
if (isset($this->_keyMap[$pIndex])) {
|
||||
return $this->getByHashCode( $this->_keyMap[$pIndex] );
|
||||
}
|
||||
/**
|
||||
* Get by index
|
||||
*
|
||||
* @param int $pIndex
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByIndex($pIndex = 0) {
|
||||
if (isset($this->_keyMap[$pIndex])) {
|
||||
return $this->getByHashCode( $this->_keyMap[$pIndex] );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by hashcode
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByHashCode($pHashCode = '') {
|
||||
if (isset($this->_items[$pHashCode])) {
|
||||
return $this->_items[$pHashCode];
|
||||
}
|
||||
/**
|
||||
* Get by hashcode
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return PHPExcel_IComparable
|
||||
*
|
||||
*/
|
||||
public function getByHashCode($pHashCode = '') {
|
||||
if (isset($this->_items[$pHashCode])) {
|
||||
return $this->_items[$pHashCode];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* HashTable to array
|
||||
*
|
||||
* @return PHPExcel_IComparable[]
|
||||
*/
|
||||
public function toArray() {
|
||||
return $this->_items;
|
||||
}
|
||||
/**
|
||||
* HashTable to array
|
||||
*
|
||||
* @return PHPExcel_IComparable[]
|
||||
*/
|
||||
public function toArray() {
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
|
@@ -18,9 +18,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_IComparable
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_IOFactory
|
||||
{
|
||||
@@ -75,7 +69,7 @@ class PHPExcel_IOFactory
|
||||
'Excel2003XML',
|
||||
'OOCalc',
|
||||
'SYLK',
|
||||
'Serialized',
|
||||
'Gnumeric',
|
||||
'CSV',
|
||||
);
|
||||
|
||||
@@ -247,6 +241,9 @@ class PHPExcel_IOFactory
|
||||
case 'xml':
|
||||
$reader = self::createReader('Excel2003XML');
|
||||
break;
|
||||
case 'gnumeric':
|
||||
$reader = self::createReader('Gnumeric');
|
||||
break;
|
||||
case 'csv':
|
||||
// Do nothing
|
||||
// We must not try to use CSV reader since it loads
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_NamedRange
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
{
|
||||
@@ -56,7 +50,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_inputEncoding;
|
||||
private $_inputEncoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Delimiter
|
||||
@@ -64,7 +58,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_delimiter;
|
||||
private $_delimiter = ',';
|
||||
|
||||
/**
|
||||
* Enclosure
|
||||
@@ -72,7 +66,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_enclosure;
|
||||
private $_enclosure = '"';
|
||||
|
||||
/**
|
||||
* Line ending
|
||||
@@ -80,7 +74,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_lineEnding;
|
||||
private $_lineEnding = PHP_EOL;
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
@@ -88,7 +82,24 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_sheetIndex;
|
||||
private $_sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Load rows contiguously
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_contiguous = false;
|
||||
|
||||
|
||||
/**
|
||||
* Row counter for loading rows contiguously
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_contiguousRow = -1;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
@@ -102,12 +113,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
* Create a new PHPExcel_Reader_CSV
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_inputEncoding = 'UTF-8';
|
||||
$this->_delimiter = ',';
|
||||
$this->_enclosure = '"';
|
||||
$this->_lineEnding = PHP_EOL;
|
||||
$this->_sheetIndex = 0;
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
} // function __construct()
|
||||
|
||||
/**
|
||||
@@ -223,37 +229,64 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16LE':
|
||||
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-16BE':
|
||||
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
||||
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32LE':
|
||||
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
break;
|
||||
case 'UTF-32BE':
|
||||
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Loop through file
|
||||
$currentRow = 0;
|
||||
$rowData = array();
|
||||
$escapeEnclosures = array( "\\" . $this->_enclosure,
|
||||
$this->_enclosure . $this->_enclosure
|
||||
);
|
||||
|
||||
// Set our starting row based on whether we're in contiguous mode or not
|
||||
$currentRow = 1;
|
||||
if ($this->_contiguous) {
|
||||
$currentRow = ($this->_contiguousRow == -1) ? $objPHPExcel->getActiveSheet()->getHighestRow(): $this->_contiguousRow;
|
||||
}
|
||||
|
||||
// Loop through each line of the file in turn
|
||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||
++$currentRow;
|
||||
$rowDataCount = count($rowData);
|
||||
for ($i = 0; $i < $rowDataCount; ++$i) {
|
||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($i);
|
||||
if ($rowData[$i] != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
|
||||
$columnLetter = 'A';
|
||||
foreach($rowData as $rowDatum) {
|
||||
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
|
||||
// Unescape enclosures
|
||||
$rowData[$i] = str_replace("\\" . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
||||
$rowData[$i] = str_replace($this->_enclosure . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
||||
$rowDatum = str_replace($escapeEnclosures, $this->_enclosure, $rowDatum);
|
||||
|
||||
// Convert encoding if necessary
|
||||
if ($this->_inputEncoding !== 'UTF-8') {
|
||||
$rowData[$i] = PHPExcel_Shared_String::ConvertEncoding($rowData[$i], 'UTF-8', $this->_inputEncoding);
|
||||
$rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->_inputEncoding);
|
||||
}
|
||||
|
||||
// Set cell value
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowData[$i]);
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowDatum);
|
||||
}
|
||||
++$columnLetter;
|
||||
}
|
||||
++$currentRow;
|
||||
}
|
||||
|
||||
// Close file
|
||||
fclose($fileHandle);
|
||||
|
||||
if ($this->_contiguous) {
|
||||
$this->_contiguousRow = $currentRow;
|
||||
}
|
||||
|
||||
// Return
|
||||
return $objPHPExcel;
|
||||
} // function loadIntoExisting()
|
||||
@@ -348,4 +381,31 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
} // function setSheetIndex()
|
||||
|
||||
/**
|
||||
* Set Contiguous
|
||||
*
|
||||
* @access public
|
||||
* @param string $pValue Input encoding
|
||||
*/
|
||||
public function setContiguous($contiguous = false)
|
||||
{
|
||||
$this->_contiguous = (bool)$contiguous;
|
||||
if (!$contiguous) {
|
||||
$this->_contiguousRow = -1;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // function setInputEncoding()
|
||||
|
||||
/**
|
||||
* Get Contiguous
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function getContiguous() {
|
||||
return $this->_contiguous;
|
||||
} // function getSheetIndex()
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
{
|
||||
@@ -64,13 +58,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_sheetIndex;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
*
|
||||
@@ -99,7 +86,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
* Set read data only
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
@@ -120,7 +107,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
@@ -132,7 +119,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
/**
|
||||
* Set all sheets to load
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
@@ -153,7 +140,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
@@ -164,7 +151,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
* Create a new PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_sheetIndex = 0;
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
@@ -188,7 +174,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
//
|
||||
|
||||
$signature = array(
|
||||
'<?xml version="1.0"?>',
|
||||
'<?xml version="1.0"',
|
||||
'<?mso-application progid="Excel.Sheet"?>'
|
||||
);
|
||||
|
||||
@@ -202,16 +188,10 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
$data = fread($fh, 2048);
|
||||
fclose($fh);
|
||||
|
||||
$headers = explode("\n",$data);
|
||||
$valid = true;
|
||||
foreach($signature as $key => $match) {
|
||||
if (isset($headers[$key])) {
|
||||
$line = trim(rtrim($headers[$key], "\r\n"));
|
||||
if ($line != $match) {
|
||||
$valid = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
foreach($signature as $match) {
|
||||
// every part of the signature must be present
|
||||
if (strpos($data, $match) === false) {
|
||||
$valid = false;
|
||||
break;
|
||||
}
|
||||
@@ -220,6 +200,34 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
return $valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
$xml = simplexml_load_file($pFilename);
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
$worksheetNames[] = $worksheet_ss['Name'];
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
@@ -272,6 +280,11 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
return $pixels;
|
||||
}
|
||||
|
||||
|
||||
private static function _hex2str($hex) {
|
||||
return chr(hexdec($hex[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
@@ -307,6 +320,9 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY
|
||||
);
|
||||
|
||||
$timezoneObj = new DateTimeZone('Europe/London');
|
||||
$GMT = new DateTimeZone('UTC');
|
||||
|
||||
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
@@ -315,48 +331,79 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
|
||||
$xml = simplexml_load_file($pFilename);
|
||||
$namespaces = $xml->getNamespaces(true);
|
||||
// echo '<pre>';
|
||||
// print_r($namespaces);
|
||||
// echo '</pre><hr />';
|
||||
//
|
||||
// echo '<pre>';
|
||||
// print_r($xml);
|
||||
// echo '</pre><hr />';
|
||||
//
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
switch ($propertyName) {
|
||||
case 'Title' :
|
||||
$docProps->setTitle($propertyValue);
|
||||
break;
|
||||
case 'Subject' :
|
||||
$docProps->setSubject($propertyValue);
|
||||
break;
|
||||
case 'Author' :
|
||||
$docProps->setCreator($propertyValue);
|
||||
break;
|
||||
case 'Created' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'LastAuthor' :
|
||||
$docProps->setLastModifiedBy($propertyValue);
|
||||
break;
|
||||
case 'Company' :
|
||||
$docProps->setCompany($propertyValue);
|
||||
break;
|
||||
case 'Category' :
|
||||
$docProps->setCategory($propertyValue);
|
||||
break;
|
||||
case 'Keywords' :
|
||||
$docProps->setKeywords($propertyValue);
|
||||
break;
|
||||
case 'Description' :
|
||||
$docProps->setDescription($propertyValue);
|
||||
break;
|
||||
if (isset($xml->DocumentProperties[0])) {
|
||||
foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
switch ($propertyName) {
|
||||
case 'Title' :
|
||||
$docProps->setTitle($propertyValue);
|
||||
break;
|
||||
case 'Subject' :
|
||||
$docProps->setSubject($propertyValue);
|
||||
break;
|
||||
case 'Author' :
|
||||
$docProps->setCreator($propertyValue);
|
||||
break;
|
||||
case 'Created' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'LastAuthor' :
|
||||
$docProps->setLastModifiedBy($propertyValue);
|
||||
break;
|
||||
case 'LastSaved' :
|
||||
$lastSaveDate = strtotime($propertyValue);
|
||||
$docProps->setModified($lastSaveDate);
|
||||
break;
|
||||
case 'Company' :
|
||||
$docProps->setCompany($propertyValue);
|
||||
break;
|
||||
case 'Category' :
|
||||
$docProps->setCategory($propertyValue);
|
||||
break;
|
||||
case 'Manager' :
|
||||
$docProps->setManager($propertyValue);
|
||||
break;
|
||||
case 'Keywords' :
|
||||
$docProps->setKeywords($propertyValue);
|
||||
break;
|
||||
case 'Description' :
|
||||
$docProps->setDescription($propertyValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($xml->CustomDocumentProperties)) {
|
||||
foreach($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
|
||||
$propertyAttributes = $propertyValue->attributes($namespaces['dt']);
|
||||
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str',$propertyName);
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
|
||||
switch((string) $propertyAttributes) {
|
||||
case 'string' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
$propertyValue = trim($propertyValue);
|
||||
break;
|
||||
case 'boolean' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
|
||||
$propertyValue = (bool) $propertyValue;
|
||||
break;
|
||||
case 'integer' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
|
||||
$propertyValue = intval($propertyValue);
|
||||
break;
|
||||
case 'float' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
|
||||
$propertyValue = floatval($propertyValue);
|
||||
break;
|
||||
case 'dateTime.tz' :
|
||||
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
|
||||
$propertyValue = strtotime(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
$docProps->setCustomProperty($propertyName,$propertyValue,$propertyType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($xml->Styles[0] as $style) {
|
||||
$style_ss = $style->attributes($namespaces['ss']);
|
||||
@@ -487,13 +534,17 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
// echo '<hr />';
|
||||
|
||||
$worksheetID = 0;
|
||||
foreach($xml->Worksheet as $worksheet) {
|
||||
$xml_ss = $xml->children($namespaces['ss']);
|
||||
foreach($xml_ss->Worksheet as $worksheet) {
|
||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||
|
||||
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
||||
(!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// echo '<h3>Worksheet: ',$worksheet_ss['Name'],'<h3>';
|
||||
//
|
||||
// Create new Worksheet
|
||||
$objPHPExcel->createSheet();
|
||||
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||
@@ -503,166 +554,220 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
$columnID = 'A';
|
||||
foreach($worksheet->Table->Column as $columnData) {
|
||||
$columnData_ss = $columnData->attributes($namespaces['ss']);
|
||||
if (isset($columnData_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
|
||||
}
|
||||
if (isset($columnData_ss['Width'])) {
|
||||
$columnWidth = $columnData_ss['Width'];
|
||||
// echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
|
||||
}
|
||||
++$columnID;
|
||||
}
|
||||
|
||||
$rowID = 1;
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||
if (isset($row_ss['Index'])) {
|
||||
$rowID = (integer) $row_ss['Index'];
|
||||
}
|
||||
// echo '<b>Row '.$rowID.'</b><br />';
|
||||
if (isset($row_ss['StyleID'])) {
|
||||
$rowStyle = $row_ss['StyleID'];
|
||||
}
|
||||
if (isset($row_ss['Height'])) {
|
||||
$rowHeight = $row_ss['Height'];
|
||||
// echo '<b>Setting row height to '.$rowHeight.'</b><br />';
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
|
||||
}
|
||||
$columnID = 'A';
|
||||
foreach($rowData->Cell as $cell) {
|
||||
|
||||
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||
if (isset($cell_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
|
||||
if (isset($worksheet->Table->Column)) {
|
||||
foreach($worksheet->Table->Column as $columnData) {
|
||||
$columnData_ss = $columnData->attributes($namespaces['ss']);
|
||||
if (isset($columnData_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
|
||||
}
|
||||
$cellRange = $columnID.$rowID;
|
||||
|
||||
if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
|
||||
$columnTo = $columnID;
|
||||
if (isset($cell_ss['MergeAcross'])) {
|
||||
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
|
||||
}
|
||||
$rowTo = $rowID;
|
||||
if (isset($cell_ss['MergeDown'])) {
|
||||
$rowTo = $rowTo + $cell_ss['MergeDown'];
|
||||
}
|
||||
$cellRange .= ':'.$columnTo.$rowTo;
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($cellRange);
|
||||
}
|
||||
|
||||
$hasCalculatedValue = false;
|
||||
$cellDataFormula = '';
|
||||
if (isset($cell_ss['Formula'])) {
|
||||
$cellDataFormula = $cell_ss['Formula'];
|
||||
// added this as a check for array formulas
|
||||
if (isset($cell_ss['ArrayRange'])) {
|
||||
$cellDataCSEFormula = $cell_ss['ArrayRange'];
|
||||
// echo "found an array formula at ".$columnID.$rowID."<br />";
|
||||
}
|
||||
$hasCalculatedValue = true;
|
||||
}
|
||||
if (isset($cell->Data)) {
|
||||
$cellValue = $cellData = $cell->Data;
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
$cellData_ss = $cellData->attributes($namespaces['ss']);
|
||||
if (isset($cellData_ss['Type'])) {
|
||||
$cellDataType = $cellData_ss['Type'];
|
||||
switch ($cellDataType) {
|
||||
/*
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
const TYPE_BOOL = 'b';
|
||||
const TYPE_NULL = 's';
|
||||
const TYPE_INLINE = 'inlineStr';
|
||||
const TYPE_ERROR = 'e';
|
||||
*/
|
||||
case 'String' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
break;
|
||||
case 'Number' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$cellValue = (float) $cellValue;
|
||||
if (floor($cellValue) == $cellValue) {
|
||||
$cellValue = (integer) $cellValue;
|
||||
}
|
||||
break;
|
||||
case 'Boolean' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$cellValue = ($cellValue != 0);
|
||||
break;
|
||||
case 'DateTime' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
|
||||
break;
|
||||
case 'Error' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($hasCalculatedValue) {
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
foreach($temp as $key => &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if (($key % 2) == 0) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $rowID;
|
||||
// Bracketed R references are relative to the current row
|
||||
if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]');
|
||||
$columnReference = $cellReference[4][0];
|
||||
// Empty C reference is the current column
|
||||
if ($columnReference == '') $columnReference = $columnNumber;
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
}
|
||||
|
||||
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||
//
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Forumla result is '.$cellValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
|
||||
}
|
||||
}
|
||||
if (isset($cell_ss['StyleID'])) {
|
||||
$style = (string) $cell_ss['StyleID'];
|
||||
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
|
||||
if ((isset($this->_styles[$style])) && (count($this->_styles[$style]) > 0)) {
|
||||
// echo 'Cell '.$columnID.$rowID.'<br />';
|
||||
// print_r($this->_styles[$style]);
|
||||
// echo '<br />';
|
||||
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL);
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
|
||||
}
|
||||
if (isset($columnData_ss['Width'])) {
|
||||
$columnWidth = $columnData_ss['Width'];
|
||||
// echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
|
||||
}
|
||||
++$columnID;
|
||||
}
|
||||
++$rowID;
|
||||
}
|
||||
|
||||
$rowID = 1;
|
||||
if (isset($worksheet->Table->Row)) {
|
||||
foreach($worksheet->Table->Row as $rowData) {
|
||||
$rowHasData = false;
|
||||
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||
if (isset($row_ss['Index'])) {
|
||||
$rowID = (integer) $row_ss['Index'];
|
||||
}
|
||||
// echo '<b>Row '.$rowID.'</b><br />';
|
||||
|
||||
$columnID = 'A';
|
||||
foreach($rowData->Cell as $cell) {
|
||||
|
||||
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||
if (isset($cell_ss['Index'])) {
|
||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
|
||||
}
|
||||
$cellRange = $columnID.$rowID;
|
||||
|
||||
if (!is_null($this->getReadFilter())) {
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
|
||||
$columnTo = $columnID;
|
||||
if (isset($cell_ss['MergeAcross'])) {
|
||||
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
|
||||
}
|
||||
$rowTo = $rowID;
|
||||
if (isset($cell_ss['MergeDown'])) {
|
||||
$rowTo = $rowTo + $cell_ss['MergeDown'];
|
||||
}
|
||||
$cellRange .= ':'.$columnTo.$rowTo;
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($cellRange);
|
||||
}
|
||||
|
||||
$cellIsSet = $hasCalculatedValue = false;
|
||||
$cellDataFormula = '';
|
||||
if (isset($cell_ss['Formula'])) {
|
||||
$cellDataFormula = $cell_ss['Formula'];
|
||||
// added this as a check for array formulas
|
||||
if (isset($cell_ss['ArrayRange'])) {
|
||||
$cellDataCSEFormula = $cell_ss['ArrayRange'];
|
||||
// echo "found an array formula at ".$columnID.$rowID."<br />";
|
||||
}
|
||||
$hasCalculatedValue = true;
|
||||
}
|
||||
if (isset($cell->Data)) {
|
||||
$cellValue = $cellData = $cell->Data;
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
$cellData_ss = $cellData->attributes($namespaces['ss']);
|
||||
if (isset($cellData_ss['Type'])) {
|
||||
$cellDataType = $cellData_ss['Type'];
|
||||
switch ($cellDataType) {
|
||||
/*
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
const TYPE_BOOL = 'b';
|
||||
const TYPE_NULL = 's';
|
||||
const TYPE_INLINE = 'inlineStr';
|
||||
const TYPE_ERROR = 'e';
|
||||
*/
|
||||
case 'String' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
break;
|
||||
case 'Number' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$cellValue = (float) $cellValue;
|
||||
if (floor($cellValue) == $cellValue) {
|
||||
$cellValue = (integer) $cellValue;
|
||||
}
|
||||
break;
|
||||
case 'Boolean' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$cellValue = ($cellValue != 0);
|
||||
break;
|
||||
case 'DateTime' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
|
||||
break;
|
||||
case 'Error' :
|
||||
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'FORMULA<br />';
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||
if (substr($cellDataFormula,0,3) == 'of:') {
|
||||
$cellDataFormula = substr($cellDataFormula,3);
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
$value = str_replace(array('[.','.',']'),'',$value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
// echo 'Before: ',$cellDataFormula,'<br />';
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
// the formula
|
||||
$cellReferences = array_reverse($cellReferences);
|
||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||
// then modify the formula to use that new reference
|
||||
foreach($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $rowID;
|
||||
// Bracketed R references are relative to the current row
|
||||
if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]');
|
||||
$columnReference = $cellReference[4][0];
|
||||
// Empty C reference is the current column
|
||||
if ($columnReference == '') $columnReference = $columnNumber;
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($value);
|
||||
// Then rebuild the formula string
|
||||
$cellDataFormula = implode('"',$temp);
|
||||
// echo 'After: ',$cellDataFormula,'<br />';
|
||||
}
|
||||
|
||||
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||
//
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type);
|
||||
if ($hasCalculatedValue) {
|
||||
// echo 'Formula result is '.$cellValue.'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
|
||||
}
|
||||
$cellIsSet = $rowHasData = true;
|
||||
}
|
||||
|
||||
if (isset($cell->Comment)) {
|
||||
// echo '<b>comment found</b><br />';
|
||||
$commentAttributes = $cell->Comment->attributes($namespaces['ss']);
|
||||
$author = 'unknown';
|
||||
if (isset($commentAttributes->Author)) {
|
||||
$author = (string)$commentAttributes->Author;
|
||||
// echo 'Author: ',$author,'<br />';
|
||||
}
|
||||
$node = $cell->Comment->Data->asXML();
|
||||
// $annotation = str_replace('html:','',substr($node,49,-10));
|
||||
// echo $annotation,'<br />';
|
||||
$annotation = strip_tags($node);
|
||||
// echo 'Annotation: ',$annotation,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
->setAuthor( $author )
|
||||
->setText($this->_parseRichText($annotation) );
|
||||
}
|
||||
|
||||
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
|
||||
$style = (string) $cell_ss['StyleID'];
|
||||
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
|
||||
if ((isset($this->_styles[$style])) && (count($this->_styles[$style]) > 0)) {
|
||||
// echo 'Cell '.$columnID.$rowID.'<br />';
|
||||
// print_r($this->_styles[$style]);
|
||||
// echo '<br />';
|
||||
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
|
||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL);
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
|
||||
}
|
||||
}
|
||||
++$columnID;
|
||||
}
|
||||
|
||||
if ($rowHasData) {
|
||||
if (isset($row_ss['StyleID'])) {
|
||||
$rowStyle = $row_ss['StyleID'];
|
||||
}
|
||||
if (isset($row_ss['Height'])) {
|
||||
$rowHeight = $row_ss['Height'];
|
||||
// echo '<b>Setting row height to '.$rowHeight.'</b><br />';
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
|
||||
}
|
||||
}
|
||||
|
||||
++$rowID;
|
||||
}
|
||||
}
|
||||
++$worksheetID;
|
||||
}
|
||||
@@ -671,23 +776,12 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
return $this->_sheetIndex;
|
||||
private function _parseRichText($is = '') {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
$value->createText($is);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
*
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Reader_Excel2003XML
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,34 +33,31 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Excel2007
|
||||
* PHPExcel_Reader_Excel2007
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
* @var boolean
|
||||
*/
|
||||
private $_readDataOnly = false;
|
||||
|
||||
/**
|
||||
* Restict which sheets should be loaded?
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array
|
||||
* @var array of string
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
@@ -71,23 +68,40 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_ReferenceHelper instance
|
||||
*
|
||||
* @var PHPExcel_ReferenceHelper
|
||||
*/
|
||||
private $_referenceHelper = null;
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* PHPExcel_Reader_Excel2007_Theme instance
|
||||
*
|
||||
* @return boolean
|
||||
* @var PHPExcel_Reader_Excel2007_Theme
|
||||
*/
|
||||
private static $_theme = null;
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
@@ -95,9 +109,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
@@ -105,10 +121,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
@@ -118,9 +137,10 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
@@ -174,39 +194,47 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$xl = false;
|
||||
// Load file
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($pFilename) === true) {
|
||||
// check if it is an OOXML archive
|
||||
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"));
|
||||
foreach ($rels->Relationship as $rel) {
|
||||
switch ($rel["Type"]) {
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
||||
if (basename($rel["Target"]) == 'workbook.xml') {
|
||||
$xl = true;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
|
||||
return ($rels !== false);
|
||||
}
|
||||
|
||||
return false;
|
||||
return $xl;
|
||||
}
|
||||
|
||||
private function _castToBool($c) {
|
||||
private static function _castToBool($c) {
|
||||
// echo 'Initial Cast to Boolean<br />';
|
||||
$value = isset($c->v) ? (string) $c->v : null;
|
||||
if ($value == '0') {
|
||||
$value = false;
|
||||
return false;
|
||||
} elseif ($value == '1') {
|
||||
$value = true;
|
||||
return true;
|
||||
} else {
|
||||
$value = (bool)$c->v;
|
||||
return (bool)$c->v;
|
||||
}
|
||||
return $value;
|
||||
} // function _castToBool()
|
||||
|
||||
private function _castToError($c) {
|
||||
private static function _castToError($c) {
|
||||
// echo 'Initial Cast to Error<br />';
|
||||
return isset($c->v) ? (string) $c->v : null;;
|
||||
} // function _castToError()
|
||||
|
||||
private function _castToString($c) {
|
||||
private static function _castToString($c) {
|
||||
// echo 'Initial Cast to String<br />';
|
||||
return isset($c->v) ? (string) $c->v : null;;
|
||||
} // function _castToString()
|
||||
@@ -216,7 +244,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
// echo '$c->f is '.$c->f.'<br />';
|
||||
$cellDataType = 'f';
|
||||
$value = "={$c->f}";
|
||||
$calculatedValue = $this->$castBaseType($c);
|
||||
$calculatedValue = self::$castBaseType($c);
|
||||
|
||||
// Shared formula?
|
||||
if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') {
|
||||
@@ -275,17 +303,48 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
$contents = $archive->getFromName(substr($fileName, 1));
|
||||
}
|
||||
|
||||
/*
|
||||
if (strpos($contents, '<?xml') !== false && strpos($contents, '<?xml') !== 0)
|
||||
{
|
||||
$contents = substr($contents, strpos($contents, '<?xml'));
|
||||
}
|
||||
var_dump($fileName);
|
||||
var_dump($contents);
|
||||
*/
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
$zip = new ZipArchive;
|
||||
$zip->open($pFilename);
|
||||
|
||||
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||
foreach ($rels->Relationship as $rel) {
|
||||
switch ($rel["Type"]) {
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
||||
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
if ($xmlWorkbook->sheets) {
|
||||
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
||||
// Check if sheet should be skipped
|
||||
$worksheetNames[] = (string) $eleSheet["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
@@ -309,6 +368,44 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
$zip = new ZipArchive;
|
||||
$zip->open($pFilename);
|
||||
|
||||
// Read the theme first, because we need the colour scheme when reading the styles
|
||||
$wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||
foreach ($wbRels->Relationship as $rel) {
|
||||
switch ($rel["Type"]) {
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
|
||||
$themeOrderArray = array('lt1','dk1','lt2','dk2');
|
||||
$themeOrderAdditional = count($themeOrderArray);
|
||||
|
||||
$xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"));
|
||||
if (is_object($xmlTheme)) {
|
||||
$xmlThemeName = $xmlTheme->attributes();
|
||||
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
$themeName = (string)$xmlThemeName['name'];
|
||||
|
||||
$colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
|
||||
$colourSchemeName = (string)$colourScheme['name'];
|
||||
$colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
$themeColours = array();
|
||||
foreach ($colourScheme as $k => $xmlColour) {
|
||||
$themePos = array_search($k,$themeOrderArray);
|
||||
if ($themePos === false) {
|
||||
$themePos = $themeOrderAdditional++;
|
||||
}
|
||||
if (isset($xmlColour->sysClr)) {
|
||||
$xmlColourData = $xmlColour->sysClr->attributes();
|
||||
$themeColours[$themePos] = $xmlColourData['lastClr'];
|
||||
} elseif (isset($xmlColour->srgbClr)) {
|
||||
$xmlColourData = $xmlColour->srgbClr->attributes();
|
||||
$themeColours[$themePos] = $xmlColourData['val'];
|
||||
}
|
||||
}
|
||||
self::$_theme = new PHPExcel_Reader_Excel2007_Theme($themeName,$colourSchemeName,$themeColours);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||
foreach ($rels->Relationship as $rel) {
|
||||
switch ($rel["Type"]) {
|
||||
@@ -345,8 +442,19 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
|
||||
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
|
||||
if (is_object($xmlCore)) {
|
||||
$xmlCore->registerXPathNamespace("vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
|
||||
$docProps = $excel->getProperties();
|
||||
foreach ($xmlCore as $xmlProperty) {
|
||||
$cellDataOfficeAttributes = $xmlProperty->attributes();
|
||||
if (isset($cellDataOfficeAttributes['name'])) {
|
||||
$propertyName = (string) $cellDataOfficeAttributes['name'];
|
||||
$cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
||||
$attributeType = $cellDataOfficeChildren->getName();
|
||||
$attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
|
||||
$attributeValue = PHPExcel_DocumentProperties::convertProperty($attributeValue,$attributeType);
|
||||
$attributeType = PHPExcel_DocumentProperties::convertPropertyType($attributeType);
|
||||
$docProps->setCustomProperty($propertyName,$attributeValue,$attributeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -418,7 +526,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
|
||||
// add style to cellXf collection
|
||||
$objStyle = new PHPExcel_Style;
|
||||
$this->_readStyle($objStyle, $style);
|
||||
self::_readStyle($objStyle, $style);
|
||||
$excel->addCellXf($objStyle);
|
||||
}
|
||||
|
||||
@@ -445,7 +553,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
|
||||
// add style to cellStyleXf collection
|
||||
$objStyle = new PHPExcel_Style;
|
||||
$this->_readStyle($objStyle, $cellStyle);
|
||||
self::_readStyle($objStyle, $cellStyle);
|
||||
$excel->addCellStyleXf($objStyle);
|
||||
}
|
||||
}
|
||||
@@ -455,7 +563,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
if ($xmlStyles->dxfs) {
|
||||
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
||||
$style = new PHPExcel_Style;
|
||||
$this->_readStyle($style, $dxf);
|
||||
self::_readStyle($style, $dxf);
|
||||
$dxfs[] = $style;
|
||||
}
|
||||
}
|
||||
@@ -467,7 +575,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
|
||||
// Set default style
|
||||
$style = new PHPExcel_Style;
|
||||
$this->_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
|
||||
self::_readStyle($style, $cellStyles[intval($cellStyle['xfId'])]);
|
||||
|
||||
// normal style, currently not using it for anything
|
||||
}
|
||||
@@ -710,7 +818,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
case "b":
|
||||
// echo 'Boolean<br />';
|
||||
if (!isset($c->f)) {
|
||||
$value = $this->_castToBool($c);
|
||||
$value = self::_castToBool($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
||||
@@ -730,7 +838,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
case "e":
|
||||
// echo 'Error<br />';
|
||||
if (!isset($c->f)) {
|
||||
$value = $this->_castToError($c);
|
||||
$value = self::_castToError($c);
|
||||
} else {
|
||||
// Formula
|
||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
|
||||
@@ -743,7 +851,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
// echo 'Default<br />';
|
||||
if (!isset($c->f)) {
|
||||
// echo 'Not a Formula<br />';
|
||||
$value = $this->_castToString($c);
|
||||
$value = self::_castToString($c);
|
||||
} else {
|
||||
// echo 'Treat as Formula<br />';
|
||||
// Formula
|
||||
@@ -1267,7 +1375,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
// Extract range
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
|
||||
// Valid range?
|
||||
if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') {
|
||||
@@ -1330,7 +1442,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
// Extract range
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
if (($spos = strpos($extractedRange,'!')) !== false) {
|
||||
$extractedRange = substr($extractedRange,0,$spos).str_replace('$', '', substr($extractedRange,$spos));
|
||||
} else {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
|
||||
// Valid range?
|
||||
if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') {
|
||||
@@ -1407,18 +1523,34 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
return $excel;
|
||||
}
|
||||
|
||||
private function _readColor($color) {
|
||||
private static function _readColor($color, $background=false) {
|
||||
if (isset($color["rgb"])) {
|
||||
return (string)$color["rgb"];
|
||||
} else if (isset($color["indexed"])) {
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"])->getARGB();
|
||||
return PHPExcel_Style_Color::indexedColor($color["indexed"],$background)->getARGB();
|
||||
} else if (isset($color["theme"])) {
|
||||
if (!is_null(self::$_theme)) {
|
||||
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);
|
||||
if (isset($color["tint"])) {
|
||||
$tintAdjust = (float) $color["tint"];
|
||||
$returnColour = PHPExcel_Style_Color::changeBrightness($returnColour, $tintAdjust);
|
||||
}
|
||||
return 'FF'.$returnColour;
|
||||
}
|
||||
}
|
||||
|
||||
if ($background) {
|
||||
return 'FFFFFFFF';
|
||||
}
|
||||
return 'FF000000';
|
||||
}
|
||||
|
||||
private function _readStyle($docStyle, $style) {
|
||||
private static function _readStyle($docStyle, $style) {
|
||||
// format code
|
||||
if (isset($style->numFmt)) {
|
||||
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
||||
@@ -1437,7 +1569,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
if (isset($style->font->strike)) {
|
||||
$docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1');
|
||||
}
|
||||
$docStyle->getFont()->getColor()->setARGB($this->_readColor($style->font->color));
|
||||
$docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color));
|
||||
|
||||
if (isset($style->font->u) && !isset($style->font->u["val"])) {
|
||||
$docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
|
||||
@@ -1460,21 +1592,23 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
if (isset($style->fill)) {
|
||||
if ($style->fill->gradientFill) {
|
||||
$gradientFill = $style->fill->gradientFill[0];
|
||||
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
||||
if(!empty($gradientFill["type"])) {
|
||||
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
||||
}
|
||||
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
|
||||
$gradientFill->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
$docStyle->getFill()->getStartColor()->setARGB($this->_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) );
|
||||
$docStyle->getFill()->getEndColor()->setARGB($this->_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) );
|
||||
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) );
|
||||
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) );
|
||||
} elseif ($style->fill->patternFill) {
|
||||
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
|
||||
$docStyle->getFill()->setFillType($patternType);
|
||||
if ($style->fill->patternFill->fgColor) {
|
||||
$docStyle->getFill()->getStartColor()->setARGB($this->_readColor($style->fill->patternFill->fgColor));
|
||||
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true));
|
||||
} else {
|
||||
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
||||
}
|
||||
if ($style->fill->patternFill->bgColor) {
|
||||
$docStyle->getFill()->getEndColor()->setARGB($this->_readColor($style->fill->patternFill->bgColor));
|
||||
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1498,11 +1632,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
} elseif ($diagonalUp == true && $diagonalDown == true) {
|
||||
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH);
|
||||
}
|
||||
$this->_readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
|
||||
$this->_readBorder($docStyle->getBorders()->getRight(), $style->border->right);
|
||||
$this->_readBorder($docStyle->getBorders()->getTop(), $style->border->top);
|
||||
$this->_readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom);
|
||||
$this->_readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal);
|
||||
self::_readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
|
||||
self::_readBorder($docStyle->getBorders()->getRight(), $style->border->right);
|
||||
self::_readBorder($docStyle->getBorders()->getTop(), $style->border->top);
|
||||
self::_readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom);
|
||||
self::_readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal);
|
||||
}
|
||||
|
||||
// alignment
|
||||
@@ -1543,12 +1677,12 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
}
|
||||
|
||||
private function _readBorder($docBorder, $eleBorder) {
|
||||
private static function _readBorder($docBorder, $eleBorder) {
|
||||
if (isset($eleBorder["style"])) {
|
||||
$docBorder->setBorderStyle((string) $eleBorder["style"]);
|
||||
}
|
||||
if (isset($eleBorder->color)) {
|
||||
$docBorder->getColor()->setARGB($this->_readColor($eleBorder->color));
|
||||
$docBorder->getColor()->setARGB(self::_readColor($eleBorder->color));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1574,7 +1708,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
if (isset($run->rPr->color)) {
|
||||
$objText->getFont()->setColor( new PHPExcel_Style_Color( $this->_readColor($run->rPr->color) ) );
|
||||
$objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) );
|
||||
}
|
||||
|
||||
if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1'))
|
||||
@@ -1623,11 +1757,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
private static function toCSSArray($style) {
|
||||
$style = str_replace("\r", "", $style);
|
||||
$style = str_replace("\n", "", $style);
|
||||
$style = str_replace(array("\r","\n"), "", $style);
|
||||
|
||||
$temp = explode(';', $style);
|
||||
|
||||
$style = array();
|
||||
foreach ($temp as $item) {
|
||||
$item = explode(':', $item);
|
||||
|
124
libraries/PHPExcel/PHPExcel/Reader/Excel2007/Theme.php
Normal file
124
libraries/PHPExcel/PHPExcel/Reader/Excel2007/Theme.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Excel2007_Theme
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel2007
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel2007_Theme
|
||||
{
|
||||
/**
|
||||
* Theme Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_themeName;
|
||||
|
||||
/**
|
||||
* Colour Scheme Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_colourSchemeName;
|
||||
|
||||
/**
|
||||
* Colour Map indexed by position
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $_colourMapValues;
|
||||
|
||||
|
||||
/**
|
||||
* Colour Map
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $_colourMap;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Theme
|
||||
*
|
||||
*/
|
||||
public function __construct($themeName,$colourSchemeName,$colourMap)
|
||||
{
|
||||
// Initialise values
|
||||
$this->_themeName = $themeName;
|
||||
$this->_colourSchemeName = $colourSchemeName;
|
||||
$this->_colourMap = $colourMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Theme Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getThemeName()
|
||||
{
|
||||
return $this->_themeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get colour Scheme Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColourSchemeName() {
|
||||
return $this->_colourSchemeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get colour Map Value by Position
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColourByIndex($index=0) {
|
||||
if (isset($this->_colourMap[$index])) {
|
||||
return $this->_colourMap[$index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if ((is_object($value)) && ($key != '_parent')) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader_Excel5
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Excel5_Escher
|
||||
{
|
||||
@@ -108,9 +108,8 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// Parse Escher stream
|
||||
while ($this->_pos < $this->_dataSize) {
|
||||
|
||||
|
||||
// offset: 2; size: 2: Record Type
|
||||
$fbt = $this->_GetInt2d($this->_data, $this->_pos + 2);
|
||||
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
|
||||
switch ($fbt) {
|
||||
case self::DGGCONTAINER: $this->_readDggContainer(); break;
|
||||
@@ -144,15 +143,15 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
private function _readDefault()
|
||||
{
|
||||
// offset 0; size: 2; recVer and recInstance
|
||||
$verInstance = $this->_GetInt2d($this->_data, $this->_pos);
|
||||
$verInstance = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos);
|
||||
|
||||
// offset: 2; size: 2: Record Type
|
||||
$fbt = $this->_GetInt2d($this->_data, $this->_pos + 2);
|
||||
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
|
||||
// bit: 0-3; mask: 0x000F; recVer
|
||||
$recVer = (0x000F & $verInstance) >> 0;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -164,7 +163,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readDggContainer()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -182,7 +181,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readDgg()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -194,7 +193,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readBstoreContainer()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -215,9 +214,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -239,16 +238,16 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$rgbUid = substr($recordData, 2, 16);
|
||||
|
||||
// offset: 18; size: 2; tag
|
||||
$tag = $this->_GetInt2d($recordData, 18);
|
||||
$tag = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 18);
|
||||
|
||||
// offset: 20; size: 4; size of BLIP in bytes
|
||||
$size = $this->_GetInt4d($recordData, 20);
|
||||
$size = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 20);
|
||||
|
||||
// offset: 24; size: 4; number of references to this BLIP
|
||||
$cRef = $this->_GetInt4d($recordData, 24);
|
||||
$cRef = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 24);
|
||||
|
||||
// offset: 28; size: 4; MSOFO file offset
|
||||
$foDelay = $this->_GetInt4d($recordData, 28);
|
||||
$foDelay = PHPExcel_Reader_Excel5::_GetInt4d($recordData, 28);
|
||||
|
||||
// offset: 32; size: 1; unused1
|
||||
$unused1 = ord($recordData{32});
|
||||
@@ -281,9 +280,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -322,9 +321,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -363,9 +362,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -382,9 +381,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -396,7 +395,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readSplitMenuColors()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -408,7 +407,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readDgContainer()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -426,7 +425,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readDg()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -440,7 +439,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
{
|
||||
// context is either context DgContainer or SpgrContainer
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -466,7 +465,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readSpContainer()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// add spContainer to spgrContainer
|
||||
@@ -486,7 +485,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readSpgr()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -501,9 +500,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -518,9 +517,9 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
// offset: 0; size: 2; recVer and recInstance
|
||||
|
||||
// bit: 4-15; mask: 0xFFF0; recInstance
|
||||
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
$recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos)) >> 4;
|
||||
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -532,35 +531,35 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readClientAnchor()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
$this->_pos += 8 + $length;
|
||||
|
||||
// offset: 2; size: 2; upper-left corner column index (0-based)
|
||||
$c1 = $this->_GetInt2d($recordData, 2);
|
||||
$c1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 2);
|
||||
|
||||
// offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
|
||||
$startOffsetX = $this->_GetInt2d($recordData, 4);
|
||||
$startOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 4);
|
||||
|
||||
// offset: 6; size: 2; upper-left corner row index (0-based)
|
||||
$r1 = $this->_GetInt2d($recordData, 6);
|
||||
$r1 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 6);
|
||||
|
||||
// offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
|
||||
$startOffsetY = $this->_GetInt2d($recordData, 8);
|
||||
$startOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 8);
|
||||
|
||||
// offset: 10; size: 2; bottom-right corner column index (0-based)
|
||||
$c2 = $this->_GetInt2d($recordData, 10);
|
||||
$c2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 10);
|
||||
|
||||
// offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
|
||||
$endOffsetX = $this->_GetInt2d($recordData, 12);
|
||||
$endOffsetX = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 12);
|
||||
|
||||
// offset: 14; size: 2; bottom-right corner row index (0-based)
|
||||
$r2 = $this->_GetInt2d($recordData, 14);
|
||||
$r2 = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 14);
|
||||
|
||||
// offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
|
||||
$endOffsetY = $this->_GetInt2d($recordData, 16);
|
||||
$endOffsetY = PHPExcel_Reader_Excel5::_GetInt2d($recordData, 16);
|
||||
|
||||
// set the start coordinates
|
||||
$this->_object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
|
||||
@@ -586,7 +585,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
*/
|
||||
private function _readClientData()
|
||||
{
|
||||
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
|
||||
$recordData = substr($this->_data, $this->_pos + 8, $length);
|
||||
|
||||
// move stream pointer to next record
|
||||
@@ -609,7 +608,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$fopte = substr($data, 6 * $i, 6);
|
||||
|
||||
// offset: 0; size: 2; opid
|
||||
$opid = $this->_GetInt2d($fopte, 0);
|
||||
$opid = PHPExcel_Reader_Excel5::_GetInt2d($fopte, 0);
|
||||
|
||||
// bit: 0-13; mask: 0x3FFF; opid.opid
|
||||
$opidOpid = (0x3FFF & $opid) >> 0;
|
||||
@@ -621,7 +620,7 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$opidFComplex = (0x8000 & $opid) >> 15;
|
||||
|
||||
// offset: 2; size: 4; the value for this property
|
||||
$op = $this->_GetInt4d($fopte, 2);
|
||||
$op = PHPExcel_Reader_Excel5::_GetInt4d($fopte, 2);
|
||||
|
||||
if ($opidFComplex) {
|
||||
$complexData = substr($splicedComplexData, 0, $op);
|
||||
@@ -638,40 +637,4 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read 16-bit unsigned integer
|
||||
*
|
||||
* @param string $data
|
||||
* @param int $pos
|
||||
* @return int
|
||||
*/
|
||||
private function _GetInt2d($data, $pos)
|
||||
{
|
||||
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read 32-bit signed integer
|
||||
*
|
||||
* @param string $data
|
||||
* @param int $pos
|
||||
* @return int
|
||||
*/
|
||||
private function _GetInt4d($data, $pos)
|
||||
{
|
||||
//return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) |
|
||||
// (ord($data[$pos + 2]) << 16) | (ord($data[$pos + 3]) << 24);
|
||||
|
||||
// FIX: represent numbers correctly on 64-bit system
|
||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
|
||||
$_or_24 = ord($data[$pos + 3]);
|
||||
if ($_or_24 >= 128) {
|
||||
// negative number
|
||||
$_ord_24 = -abs((256 - $_or_24) << 24);
|
||||
} else {
|
||||
$_ord_24 = ($_or_24 & 127) << 24;
|
||||
}
|
||||
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
|
||||
}
|
||||
|
||||
}
|
||||
|
914
libraries/PHPExcel/PHPExcel/Reader/Gnumeric.php
Normal file
914
libraries/PHPExcel/PHPExcel/Reader/Gnumeric.php
Normal file
@@ -0,0 +1,914 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Gnumeric
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_readDataOnly = false;
|
||||
|
||||
/**
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array of string
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_styles = array();
|
||||
|
||||
/**
|
||||
* Shared Expressions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_expressions = array();
|
||||
|
||||
private $_referenceHelper = null;
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_IReadFilter instance
|
||||
*
|
||||
* @var PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
private $_readFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
return $this->_loadSheetsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
$this->_loadSheetsOnly = is_array($value) ?
|
||||
$value : array($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
$this->_loadSheetsOnly = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read filter
|
||||
*
|
||||
* @return PHPExcel_Reader_IReadFilter
|
||||
*/
|
||||
public function getReadFilter() {
|
||||
return $this->_readFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Reader_Gnumeric
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
// Check if gzlib functions are available
|
||||
if (!function_exists('gzread')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Read signature data (first 3 bytes)
|
||||
$fh = fopen($pFilename, 'r');
|
||||
$data = fread($fh, 2);
|
||||
fclose($fh);
|
||||
|
||||
if ($data != chr(0x1F).chr(0x8B)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
// Create new PHPExcel
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// Load into this instance
|
||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||
}
|
||||
|
||||
private function _gzfileGetContents($filename) {
|
||||
$file = @gzopen($filename, 'rb');
|
||||
if ($file !== false) {
|
||||
$data = '';
|
||||
while (!gzeof($file)) {
|
||||
$data .= gzread($file, 1024);
|
||||
}
|
||||
gzclose($file);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||
|
||||
$xml = simplexml_load_string($gFileData);
|
||||
$namespacesMeta = $xml->getNamespaces(true);
|
||||
|
||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$worksheetNames[] = (string) $sheet->Name;
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file into PHPExcel instance
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param PHPExcel $objPHPExcel
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$timezoneObj = new DateTimeZone('Europe/London');
|
||||
$GMT = new DateTimeZone('UTC');
|
||||
|
||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||
|
||||
// echo '<pre>';
|
||||
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
|
||||
// echo '</pre><hr />';
|
||||
//
|
||||
$xml = simplexml_load_string($gFileData);
|
||||
$namespacesMeta = $xml->getNamespaces(true);
|
||||
|
||||
// var_dump($namespacesMeta);
|
||||
//
|
||||
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
||||
|
||||
$docProps = $objPHPExcel->getProperties();
|
||||
// Document Properties are held differently, depending on the version of Gnumeric
|
||||
if (isset($namespacesMeta['office'])) {
|
||||
$officeXML = $xml->children($namespacesMeta['office']);
|
||||
$officeDocXML = $officeXML->{'document-meta'};
|
||||
$officeDocMetaXML = $officeDocXML->meta;
|
||||
|
||||
foreach($officeDocMetaXML as $officePropertyData) {
|
||||
|
||||
$officePropertyDC = array();
|
||||
if (isset($namespacesMeta['dc'])) {
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
$docProps->setTitle(trim($propertyValue));
|
||||
break;
|
||||
case 'subject' :
|
||||
$docProps->setSubject(trim($propertyValue));
|
||||
break;
|
||||
case 'creator' :
|
||||
$docProps->setCreator(trim($propertyValue));
|
||||
$docProps->setLastModifiedBy(trim($propertyValue));
|
||||
break;
|
||||
case 'date' :
|
||||
$creationDate = strtotime(trim($propertyValue));
|
||||
$docProps->setCreated($creationDate);
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'description' :
|
||||
$docProps->setDescription(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
$officePropertyMeta = array();
|
||||
if (isset($namespacesMeta['meta'])) {
|
||||
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$attributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
$propertyValue = (string) $propertyValue;
|
||||
switch ($propertyName) {
|
||||
case 'keyword' :
|
||||
$docProps->setKeywords(trim($propertyValue));
|
||||
break;
|
||||
case 'initial-creator' :
|
||||
$docProps->setCreator(trim($propertyValue));
|
||||
$docProps->setLastModifiedBy(trim($propertyValue));
|
||||
break;
|
||||
case 'creation-date' :
|
||||
$creationDate = strtotime(trim($propertyValue));
|
||||
$docProps->setCreated($creationDate);
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'user-defined' :
|
||||
list(,$attrName) = explode(':',$attributes['name']);
|
||||
switch ($attrName) {
|
||||
case 'publisher' :
|
||||
$docProps->setCompany(trim($propertyValue));
|
||||
break;
|
||||
case 'category' :
|
||||
$docProps->setCategory(trim($propertyValue));
|
||||
break;
|
||||
case 'manager' :
|
||||
$docProps->setManager(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (isset($gnmXML->Summary)) {
|
||||
foreach($gnmXML->Summary->Item as $summaryItem) {
|
||||
$propertyName = $summaryItem->name;
|
||||
$propertyValue = $summaryItem->{'val-string'};
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
$docProps->setTitle(trim($propertyValue));
|
||||
break;
|
||||
case 'comments' :
|
||||
$docProps->setDescription(trim($propertyValue));
|
||||
break;
|
||||
case 'keywords' :
|
||||
$docProps->setKeywords(trim($propertyValue));
|
||||
break;
|
||||
case 'category' :
|
||||
$docProps->setCategory(trim($propertyValue));
|
||||
break;
|
||||
case 'manager' :
|
||||
$docProps->setManager(trim($propertyValue));
|
||||
break;
|
||||
case 'author' :
|
||||
$docProps->setCreator(trim($propertyValue));
|
||||
$docProps->setLastModifiedBy(trim($propertyValue));
|
||||
break;
|
||||
case 'company' :
|
||||
$docProps->setCompany(trim($propertyValue));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$worksheetID = 0;
|
||||
foreach($gnmXML->Sheets->Sheet as $sheet) {
|
||||
$worksheetName = (string) $sheet->Name;
|
||||
// echo '<b>Worksheet: ',$worksheetName,'</b><br />';
|
||||
if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$maxRow = $maxCol = 0;
|
||||
|
||||
// Create new Worksheet
|
||||
$objPHPExcel->createSheet();
|
||||
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
|
||||
if (isset($sheet->PrintInformation->Margins)) {
|
||||
foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
|
||||
$marginAttributes = $margin->attributes();
|
||||
$marginSize = 72 / 100; // Default
|
||||
switch($marginAttributes['PrefUnit']) {
|
||||
case 'mm' :
|
||||
$marginSize = intval($marginAttributes['Points']) / 100;
|
||||
break;
|
||||
}
|
||||
switch($key) {
|
||||
case 'top' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
|
||||
break;
|
||||
case 'bottom' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
|
||||
break;
|
||||
case 'left' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
|
||||
break;
|
||||
case 'right' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
|
||||
break;
|
||||
case 'header' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
|
||||
break;
|
||||
case 'footer' :
|
||||
$objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($sheet->Cells->Cell as $cell) {
|
||||
$cellAttributes = $cell->attributes();
|
||||
$row = (int) $cellAttributes->Row + 1;
|
||||
$column = (int) $cellAttributes->Col;
|
||||
|
||||
if ($row > $maxRow) $maxRow = $row;
|
||||
if ($column > $maxCol) $maxCol = $column;
|
||||
|
||||
$column = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||
|
||||
// Read cell?
|
||||
if (!is_null($this->getReadFilter())) {
|
||||
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ValueType = $cellAttributes->ValueType;
|
||||
$ExprID = (string) $cellAttributes->ExprID;
|
||||
// echo 'Cell ',$column,$row,'<br />';
|
||||
// echo 'Type is ',$ValueType,'<br />';
|
||||
// echo 'Value is ',$cell,'<br />';
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
if ($ExprID > '') {
|
||||
if (((string) $cell) > '') {
|
||||
|
||||
$this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col,
|
||||
'row' => $cellAttributes->Row,
|
||||
'formula' => (string) $cell
|
||||
);
|
||||
// echo 'NEW EXPRESSION ',$ExprID,'<br />';
|
||||
} else {
|
||||
$expression = $this->_expressions[$ExprID];
|
||||
|
||||
$cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'],
|
||||
'A1',
|
||||
$cellAttributes->Col - $expression['column'],
|
||||
$cellAttributes->Row - $expression['row'],
|
||||
$worksheetName
|
||||
);
|
||||
// echo 'SHARED EXPRESSION ',$ExprID,'<br />';
|
||||
// echo 'New Value is ',$cell,'<br />';
|
||||
}
|
||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
} else {
|
||||
switch($ValueType) {
|
||||
case '10' : // NULL
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
break;
|
||||
case '20' : // Boolean
|
||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
$cell = ($cell == 'TRUE') ? True : False;
|
||||
break;
|
||||
case '30' : // Integer
|
||||
$cell = intval($cell);
|
||||
case '40' : // Float
|
||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
break;
|
||||
case '50' : // Error
|
||||
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
break;
|
||||
case '60' : // String
|
||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
break;
|
||||
case '70' : // Cell Range
|
||||
case '80' : // Array
|
||||
}
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type);
|
||||
}
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
|
||||
foreach($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
|
||||
$commentAttributes = $comment->attributes();
|
||||
// Only comment objects are handled at the moment
|
||||
if ($commentAttributes->Text) {
|
||||
$objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound )
|
||||
->setAuthor( (string)$commentAttributes->Author )
|
||||
->setText($this->_parseRichText((string)$commentAttributes->Text) );
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />';
|
||||
//
|
||||
foreach($sheet->Styles->StyleRegion as $styleRegion) {
|
||||
$styleAttributes = $styleRegion->attributes();
|
||||
// var_dump($styleAttributes);
|
||||
// echo '<br />';
|
||||
|
||||
if (($styleAttributes['startRow'] <= $maxRow) &&
|
||||
($styleAttributes['startCol'] <= $maxCol)) {
|
||||
|
||||
$startColumn = PHPExcel_Cell::stringFromColumnIndex($styleAttributes['startCol']);
|
||||
$startRow = $styleAttributes['startRow'] + 1;
|
||||
|
||||
$endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : $styleAttributes['endCol'];
|
||||
$endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn);
|
||||
$endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
|
||||
$endRow += 1;
|
||||
$cellRange = $startColumn.$startRow.':'.$endColumn.$endRow;
|
||||
// echo $cellRange,'<br />';
|
||||
|
||||
$styleAttributes = $styleRegion->Style->attributes();
|
||||
// var_dump($styleAttributes);
|
||||
// echo '<br />';
|
||||
|
||||
// We still set the number format mask for date/time values, even if _readDataOnly is true
|
||||
if ((!$this->_readDataOnly) ||
|
||||
(PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) {
|
||||
$styleArray = array();
|
||||
$styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
|
||||
// If _readDataOnly is false, we set all formatting information
|
||||
if (!$this->_readDataOnly) {
|
||||
switch($styleAttributes['HAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
break;
|
||||
case '2' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
|
||||
break;
|
||||
case '4' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
|
||||
break;
|
||||
case '8' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
|
||||
break;
|
||||
case '16' :
|
||||
case '64' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
|
||||
break;
|
||||
case '32' :
|
||||
$styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
|
||||
break;
|
||||
}
|
||||
|
||||
switch($styleAttributes['VAlign']) {
|
||||
case '1' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
|
||||
break;
|
||||
case '2' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
|
||||
break;
|
||||
case '4' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
|
||||
break;
|
||||
case '8' :
|
||||
$styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
|
||||
break;
|
||||
}
|
||||
|
||||
$styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? True : False;
|
||||
$styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? True : False;
|
||||
$styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
|
||||
|
||||
$RGB = self::_parseGnumericColour($styleAttributes["Fore"]);
|
||||
$styleArray['font']['color']['rgb'] = $RGB;
|
||||
$RGB = self::_parseGnumericColour($styleAttributes["Back"]);
|
||||
$shade = $styleAttributes["Shade"];
|
||||
if (($RGB != '000000') || ($shade != '0')) {
|
||||
$styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
|
||||
$RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
|
||||
$styleArray['fill']['endcolor']['rgb'] = $RGB2;
|
||||
switch($shade) {
|
||||
case '1' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
|
||||
break;
|
||||
case '2' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
|
||||
break;
|
||||
case '3' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
|
||||
break;
|
||||
case '4' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
|
||||
break;
|
||||
case '5' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
|
||||
break;
|
||||
case '6' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
|
||||
break;
|
||||
case '7' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
|
||||
break;
|
||||
case '8' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
|
||||
break;
|
||||
case '9' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
|
||||
break;
|
||||
case '10' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
|
||||
break;
|
||||
case '11' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
|
||||
break;
|
||||
case '12' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
|
||||
break;
|
||||
case '13' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
|
||||
break;
|
||||
case '14' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
|
||||
break;
|
||||
case '15' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
|
||||
break;
|
||||
case '16' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
|
||||
break;
|
||||
case '17' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
|
||||
break;
|
||||
case '18' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
|
||||
break;
|
||||
case '19' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
|
||||
break;
|
||||
case '20' :
|
||||
$styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$fontAttributes = $styleRegion->Style->Font->attributes();
|
||||
// var_dump($fontAttributes);
|
||||
// echo '<br />';
|
||||
$styleArray['font']['name'] = (string) $styleRegion->Style->Font;
|
||||
$styleArray['font']['size'] = intval($fontAttributes['Unit']);
|
||||
$styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False;
|
||||
$styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False;
|
||||
$styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False;
|
||||
switch($fontAttributes['Underline']) {
|
||||
case '1' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
|
||||
break;
|
||||
case '2' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
|
||||
break;
|
||||
case '3' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
|
||||
break;
|
||||
case '4' :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
|
||||
break;
|
||||
default :
|
||||
$styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
|
||||
break;
|
||||
}
|
||||
switch($fontAttributes['Script']) {
|
||||
case '1' :
|
||||
$styleArray['font']['superScript'] = True;
|
||||
break;
|
||||
case '-1' :
|
||||
$styleArray['font']['subScript'] = True;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($styleRegion->Style->StyleBorder)) {
|
||||
if (isset($styleRegion->Style->StyleBorder->Top)) {
|
||||
$styleArray['borders']['top'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes());
|
||||
}
|
||||
if (isset($styleRegion->Style->StyleBorder->Bottom)) {
|
||||
$styleArray['borders']['bottom'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes());
|
||||
}
|
||||
if (isset($styleRegion->Style->StyleBorder->Left)) {
|
||||
$styleArray['borders']['left'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes());
|
||||
}
|
||||
if (isset($styleRegion->Style->StyleBorder->Right)) {
|
||||
$styleArray['borders']['right'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes());
|
||||
}
|
||||
if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
|
||||
$styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
|
||||
$styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH;
|
||||
} elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
|
||||
$styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
|
||||
$styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP;
|
||||
} elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
|
||||
$styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
|
||||
$styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
|
||||
}
|
||||
}
|
||||
if (isset($styleRegion->Style->HyperLink)) {
|
||||
// TO DO
|
||||
$hyperlink = $styleRegion->Style->HyperLink->attributes();
|
||||
}
|
||||
}
|
||||
// var_dump($styleArray);
|
||||
// echo '<br />';
|
||||
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->Cols))) {
|
||||
// Column Widths
|
||||
$columnAttributes = $sheet->Cols->attributes();
|
||||
$defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
|
||||
$c = 0;
|
||||
foreach($sheet->Cols->ColInfo as $columnOverride) {
|
||||
$columnAttributes = $columnOverride->attributes();
|
||||
$column = $columnAttributes['No'];
|
||||
$columnWidth = $columnAttributes['Unit'] / 5.4;
|
||||
$hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false;
|
||||
$columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1;
|
||||
while ($c < $column) {
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
|
||||
++$c;
|
||||
}
|
||||
while (($c < ($column+$columnCount)) && ($c <= $maxCol)) {
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth);
|
||||
if ($hidden) {
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false);
|
||||
}
|
||||
++$c;
|
||||
}
|
||||
}
|
||||
while ($c <= $maxCol) {
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
|
||||
++$c;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!$this->_readDataOnly) && (isset($sheet->Rows))) {
|
||||
// Row Heights
|
||||
$rowAttributes = $sheet->Rows->attributes();
|
||||
$defaultHeight = $rowAttributes['DefaultSizePts'];
|
||||
$r = 0;
|
||||
|
||||
foreach($sheet->Rows->RowInfo as $rowOverride) {
|
||||
$rowAttributes = $rowOverride->attributes();
|
||||
$row = $rowAttributes['No'];
|
||||
$rowHeight = $rowAttributes['Unit'];
|
||||
$hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false;
|
||||
$rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1;
|
||||
while ($r < $row) {
|
||||
++$r;
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
|
||||
}
|
||||
while (($r < ($row+$rowCount)) && ($r < $maxRow)) {
|
||||
++$r;
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight);
|
||||
if ($hidden) {
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($r)->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
while ($r < $maxRow) {
|
||||
++$r;
|
||||
$objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Merged Cells in this worksheet
|
||||
if (isset($sheet->MergedRegions)) {
|
||||
foreach($sheet->MergedRegions->Merge as $mergeCells) {
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
|
||||
}
|
||||
}
|
||||
|
||||
$worksheetID++;
|
||||
}
|
||||
|
||||
// Loop through definedNames (global named ranges)
|
||||
if (isset($gnmXML->Names)) {
|
||||
foreach($gnmXML->Names->Name as $namedRange) {
|
||||
$name = (string) $namedRange->name;
|
||||
$range = (string) $namedRange->value;
|
||||
if (stripos($range, '#REF!') !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$range = explode('!',$range);
|
||||
$range[0] = trim($range[0],"'");;
|
||||
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
|
||||
$extractedRange = str_replace('$', '', $range[1]);
|
||||
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return
|
||||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
private static function _parseBorderAttributes($borderAttributes) {
|
||||
$styleArray = array();
|
||||
|
||||
if (isset($borderAttributes["Color"])) {
|
||||
$RGB = self::_parseGnumericColour($borderAttributes["Color"]);
|
||||
$styleArray['color']['rgb'] = $RGB;
|
||||
}
|
||||
|
||||
switch ($borderAttributes["Style"]) {
|
||||
case '0' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
|
||||
break;
|
||||
case '1' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case '2' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
|
||||
break;
|
||||
case '4' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
|
||||
break;
|
||||
case '5' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
|
||||
break;
|
||||
case '6' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
|
||||
break;
|
||||
case '7' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
|
||||
break;
|
||||
case '9' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
|
||||
break;
|
||||
case '10' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
|
||||
break;
|
||||
case '11' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
|
||||
break;
|
||||
case '12' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
|
||||
break;
|
||||
case '13' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
|
||||
break;
|
||||
case '3' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
|
||||
break;
|
||||
case '8' :
|
||||
$styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
|
||||
break;
|
||||
}
|
||||
return $styleArray;
|
||||
}
|
||||
|
||||
private function _parseRichText($is = '') {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
$value->createText($is);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private static function _parseGnumericColour($gnmColour) {
|
||||
list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
|
||||
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2);
|
||||
$RGB = $gnmR.$gnmG.$gnmB;
|
||||
// echo 'Excel Colour: ',$RGB,'<br />';
|
||||
return $RGB;
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Reader_IReadFilter
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Reader_IReader
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,44 +33,34 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_OOCalc
|
||||
* PHPExcel_Reader_OOCalc
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Read data only?
|
||||
* Read data only?
|
||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||
* or whether it should read both data and formatting
|
||||
*
|
||||
* @var boolean
|
||||
* @var boolean
|
||||
*/
|
||||
private $_readDataOnly = false;
|
||||
|
||||
/**
|
||||
* Restict which sheets should be loaded?
|
||||
* Restrict which sheets should be loaded?
|
||||
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
|
||||
*
|
||||
* @var array
|
||||
* @var array of string
|
||||
*/
|
||||
private $_loadSheetsOnly = null;
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_sheetIndex;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
*
|
||||
@@ -87,19 +77,24 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
* Read data only?
|
||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||
* If false (the default) it will read data and formatting.
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReadDataOnly() {
|
||||
return $this->_readDataOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set read data only
|
||||
* Set read data only
|
||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
|
||||
*
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @param boolean $pValue
|
||||
*
|
||||
* @return PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function setReadDataOnly($pValue = false) {
|
||||
$this->_readDataOnly = $pValue;
|
||||
@@ -107,9 +102,11 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which sheets to load
|
||||
* Get which sheets to load
|
||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||
* indicating that all worksheets in the workbook should be loaded.
|
||||
*
|
||||
* @return mixed
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLoadSheetsOnly()
|
||||
{
|
||||
@@ -117,10 +114,13 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which sheets to load
|
||||
* Set which sheets to load
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @param mixed $value
|
||||
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
|
||||
* If NULL, then it tells the Reader to read all worksheets in the workbook
|
||||
*
|
||||
* @return PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function setLoadSheetsOnly($value = null)
|
||||
{
|
||||
@@ -130,9 +130,10 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all sheets to load
|
||||
* Set all sheets to load
|
||||
* Tells the Reader to load all worksheets from the workbook.
|
||||
*
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function setLoadAllSheets()
|
||||
{
|
||||
@@ -153,7 +154,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
* Set read filter
|
||||
*
|
||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||
* @return PHPExcel_Reader_Excel2007
|
||||
* @return PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||
$this->_readFilter = $pValue;
|
||||
@@ -164,7 +165,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
* Create a new PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_sheetIndex = 0;
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
@@ -200,6 +200,42 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listWorksheetNames($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
$worksheetNames = array();
|
||||
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($pFilename) === true) {
|
||||
|
||||
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
||||
$namespacesContent = $xml->getNamespaces(true);
|
||||
|
||||
$workbook = $xml->children($namespacesContent['office']);
|
||||
foreach($workbook->body->spreadsheet as $workbookData) {
|
||||
$workbookData = $workbookData->children($namespacesContent['table']);
|
||||
foreach($workbookData->table as $worksheetDataSet) {
|
||||
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
||||
|
||||
$worksheetNames[] = $worksheetDataAttributes['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $worksheetNames;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads PHPExcel from file
|
||||
*
|
||||
@@ -262,8 +298,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||
}
|
||||
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||
// echo $propertyName.' = '.$propertyValue.'<hr />';
|
||||
|
||||
switch ($propertyName) {
|
||||
case 'title' :
|
||||
$docProps->setTitle($propertyValue);
|
||||
@@ -273,10 +307,12 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
break;
|
||||
case 'creator' :
|
||||
$docProps->setCreator($propertyValue);
|
||||
$docProps->setLastModifiedBy($propertyValue);
|
||||
break;
|
||||
case 'date' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
$docProps->setModified($creationDate);
|
||||
break;
|
||||
case 'description' :
|
||||
$docProps->setDescription($propertyValue);
|
||||
@@ -289,17 +325,43 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
}
|
||||
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||
|
||||
// echo $propertyName.' = '.$propertyValue.'<br />';
|
||||
// foreach ($propertyValueAttributes as $key => $value) {
|
||||
// echo $key.' = '.$value.'<br />';
|
||||
// }
|
||||
// echo '<hr />';
|
||||
//
|
||||
switch ($propertyName) {
|
||||
case 'initial-creator' :
|
||||
$docProps->setCreator($propertyValue);
|
||||
break;
|
||||
case 'keyword' :
|
||||
$docProps->setKeywords($propertyValue);
|
||||
break;
|
||||
case 'creation-date' :
|
||||
$creationDate = strtotime($propertyValue);
|
||||
$docProps->setCreated($creationDate);
|
||||
break;
|
||||
case 'user-defined' :
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
foreach ($propertyValueAttributes as $key => $value) {
|
||||
if ($key == 'name') {
|
||||
$propertyValueName = (string) $value;
|
||||
} elseif($key == 'value-type') {
|
||||
switch ($value) {
|
||||
case 'date' :
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
|
||||
break;
|
||||
case 'boolean' :
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
|
||||
break;
|
||||
case 'float' :
|
||||
$propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4');
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
|
||||
break;
|
||||
default :
|
||||
$propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
|
||||
}
|
||||
}
|
||||
}
|
||||
$docProps->setCustomProperty($propertyValueName,$propertyValue,$propertyValueType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,8 +411,15 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
case 'table-row' :
|
||||
$columnID = 'A';
|
||||
foreach($rowData as $key => $cellData) {
|
||||
if (!is_null($this->getReadFilter())) {
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// echo '<b>'.$columnID.$rowID.'</b><br />';
|
||||
$cellDataText = $cellData->children($namespacesContent['text']);
|
||||
$cellDataOffice = $cellData->children($namespacesContent['office']);
|
||||
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
|
||||
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
|
||||
|
||||
@@ -370,6 +439,22 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
$hasCalculatedValue = true;
|
||||
}
|
||||
|
||||
if (isset($cellDataOffice->annotation)) {
|
||||
// echo 'Cell has comment<br />';
|
||||
$annotationText = $cellDataOffice->annotation->children($namespacesContent['text']);
|
||||
$textArray = array();
|
||||
foreach($annotationText as $t) {
|
||||
foreach($t->span as $text) {
|
||||
$textArray[] = (string)$text;
|
||||
}
|
||||
}
|
||||
$text = implode("\n",$textArray);
|
||||
// echo $text,'<br />';
|
||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
||||
// ->setAuthor( $author )
|
||||
->setText($this->_parseRichText($text) );
|
||||
}
|
||||
|
||||
if (isset($cellDataText->p)) {
|
||||
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
|
||||
switch ($cellDataOfficeAttributes['value-type']) {
|
||||
@@ -422,9 +507,10 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
// echo 'Formula: '.$cellDataFormula.'<br />';
|
||||
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
foreach($temp as $key => &$value) {
|
||||
$tKey = false;
|
||||
foreach($temp as &$value) {
|
||||
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||
if (($key % 2) == 0) {
|
||||
if ($tKey = !$tKey) {
|
||||
$value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value);
|
||||
$value = preg_replace('/\[\.(.*)\]/Ui','$1',$value);
|
||||
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces);
|
||||
@@ -485,23 +571,12 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
return $this->_sheetIndex;
|
||||
private function _parseRichText($is = '') {
|
||||
$value = new PHPExcel_RichText();
|
||||
|
||||
$value->createText($is);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sheet index
|
||||
*
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Reader_OOCalc
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
{
|
||||
@@ -55,35 +49,14 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_inputEncoding;
|
||||
|
||||
/**
|
||||
* Delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_delimiter;
|
||||
|
||||
/**
|
||||
* Enclosure
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_enclosure;
|
||||
|
||||
/**
|
||||
* Line ending
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lineEnding;
|
||||
private $_inputEncoding = 'ANSI';
|
||||
|
||||
/**
|
||||
* Sheet index to read
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_sheetIndex;
|
||||
private $_sheetIndex = 0;
|
||||
|
||||
/**
|
||||
* Formats
|
||||
@@ -110,11 +83,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
* Create a new PHPExcel_Reader_SYLK
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_inputEncoding = 'ANSI';
|
||||
$this->_delimiter = ';';
|
||||
$this->_enclosure = '"';
|
||||
$this->_lineEnding = PHP_EOL;
|
||||
$this->_sheetIndex = 0;
|
||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||
}
|
||||
|
||||
@@ -302,9 +270,10 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
$temp = explode('"',$cellDataFormula);
|
||||
foreach($temp as $key => &$value) {
|
||||
$key = false;
|
||||
foreach($temp as &$value) {
|
||||
// Only count/replace in alternate array entries
|
||||
if (($key % 2) == 0) {
|
||||
if ($key = !$key) {
|
||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||
// through the formula from left to right. Reversing means that we work right to left.through
|
||||
@@ -423,69 +392,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||
return $objPHPExcel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get delimiter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter() {
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set delimiter
|
||||
*
|
||||
* @param string $pValue Delimiter, defaults to ,
|
||||
* @return PHPExcel_Reader_SYLK
|
||||
*/
|
||||
public function setDelimiter($pValue = ',') {
|
||||
$this->_delimiter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enclosure
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnclosure() {
|
||||
return $this->_enclosure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set enclosure
|
||||
*
|
||||
* @param string $pValue Enclosure, defaults to "
|
||||
* @return PHPExcel_Reader_SYLK
|
||||
*/
|
||||
public function setEnclosure($pValue = '"') {
|
||||
if ($pValue == '') {
|
||||
$pValue = '"';
|
||||
}
|
||||
$this->_enclosure = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line ending
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineEnding() {
|
||||
return $this->_lineEnding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set line ending
|
||||
*
|
||||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||
* @return PHPExcel_Reader_SYLK
|
||||
*/
|
||||
public function setLineEnding($pValue = PHP_EOL) {
|
||||
$this->_lineEnding = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sheet index
|
||||
*
|
||||
|
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
*/
|
||||
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Reader_Serialized
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Reader
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Reader_Serialized implements PHPExcel_Reader_IReader
|
||||
{
|
||||
/**
|
||||
* Can the current PHPExcel_Reader_IReader read the file?
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
return $this->fileSupportsUnserializePHPExcel($pFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads PHPExcel Serialized file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
* @throws Exception
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// Unserialize... First make sure the file supports it!
|
||||
if (!$this->fileSupportsUnserializePHPExcel($pFilename)) {
|
||||
throw new Exception("Invalid file format for PHPExcel_Reader_Serialized: " . $pFilename . ".");
|
||||
}
|
||||
|
||||
return $this->_loadSerialized($pFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load PHPExcel Serialized file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPExcel
|
||||
*/
|
||||
private function _loadSerialized($pFilename) {
|
||||
$xmlData = simplexml_load_string(file_get_contents("zip://$pFilename#phpexcel.xml"));
|
||||
$excel = unserialize(base64_decode((string)$xmlData->data));
|
||||
|
||||
// Update media links
|
||||
for ($i = 0; $i < $excel->getSheetCount(); ++$i) {
|
||||
for ($j = 0; $j < $excel->getSheet($i)->getDrawingCollection()->count(); ++$j) {
|
||||
if ($excel->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcl_Worksheet_BaseDrawing) {
|
||||
$imgTemp =& $excel->getSheet($i)->getDrawingCollection()->offsetGet($j);
|
||||
$imgTemp->setPath('zip://' . $pFilename . '#media/' . $imgTemp->getFilename(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $excel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a file support UnserializePHPExcel ?
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function fileSupportsUnserializePHPExcel($pFilename = '') {
|
||||
// Check if file exists
|
||||
if (!file_exists($pFilename)) {
|
||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||
}
|
||||
|
||||
// File exists, does it contain phpexcel.xml?
|
||||
return PHPExcel_Shared_File::file_exists("zip://$pFilename#phpexcel.xml");
|
||||
}
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_ReferenceHelper
|
||||
{
|
||||
@@ -137,7 +137,8 @@ class PHPExcel_ReferenceHelper
|
||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
// Formula should be adjusted
|
||||
$pSheet->getCell($newCoordinates)
|
||||
->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
->setValue($this->updateFormulaReferences($cell->getValue(),
|
||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
} else {
|
||||
// Formula should not be adjusted
|
||||
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
|
||||
@@ -145,6 +146,16 @@ class PHPExcel_ReferenceHelper
|
||||
|
||||
// Clear the original cell
|
||||
$pSheet->getCell($cell->getCoordinate())->setValue('');
|
||||
|
||||
} else {
|
||||
/* We don't need to update styles for rows/columns before our insertion position,
|
||||
but we do still need to adjust any formulae in those cells */
|
||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
// Formula should be adjusted
|
||||
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
|
||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +259,14 @@ class PHPExcel_ReferenceHelper
|
||||
}
|
||||
}
|
||||
|
||||
// Update worksheet: comments
|
||||
$aComments = $pSheet->getComments();
|
||||
$aNewComments = array(); // the new array of all comments
|
||||
foreach ($aComments as $key => &$value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewComments[$newReference] = $value;
|
||||
}
|
||||
$pSheet->setComments($aNewComments); // replace the comments array
|
||||
|
||||
// Update worksheet: hyperlinks
|
||||
$aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true);
|
||||
@@ -348,9 +367,10 @@ class PHPExcel_ReferenceHelper
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||
// Update cell references in the formula
|
||||
$formulaBlocks = explode('"',$pFormula);
|
||||
foreach($formulaBlocks as $i => &$formulaBlock) {
|
||||
// Ignore blocks that were enclosed in quotes (even entries in the $formulaBlocks array after the explode)
|
||||
if (($i % 2) == 0) {
|
||||
$i = false;
|
||||
foreach($formulaBlocks as &$formulaBlock) {
|
||||
// Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
|
||||
if ($i = !$i) {
|
||||
$adjustCount = 0;
|
||||
$newCellTokens = $cellTokens = array();
|
||||
// Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
|
||||
@@ -525,7 +545,7 @@ class PHPExcel_ReferenceHelper
|
||||
/**
|
||||
* Update cell range
|
||||
*
|
||||
* @param string $pCellRange Cell range
|
||||
* @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3')
|
||||
* @param int $pBefore Insert before this one
|
||||
* @param int $pNumCols Number of columns to increment
|
||||
* @param int $pNumRows Number of rows to increment
|
||||
@@ -536,9 +556,19 @@ class PHPExcel_ReferenceHelper
|
||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||
// Update range
|
||||
$range = PHPExcel_Cell::splitRange($pCellRange);
|
||||
for ($i = 0; $i < count($range); ++$i) {
|
||||
for ($j = 0; $j < count($range[$i]); ++$j) {
|
||||
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
||||
$ic = count($range);
|
||||
for ($i = 0; $i < $ic; ++$i) {
|
||||
$jc = count($range[$i]);
|
||||
for ($j = 0; $j < $jc; ++$j) {
|
||||
if (ctype_alpha($range[$i][$j])) {
|
||||
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
|
||||
$range[$i][$j] = $r[0];
|
||||
} elseif(ctype_digit($range[$i][$j])) {
|
||||
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
|
||||
$range[$i][$j] = $r[1];
|
||||
} else {
|
||||
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,29 +592,17 @@ class PHPExcel_ReferenceHelper
|
||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
||||
// Get coordinates of $pBefore
|
||||
$beforeColumn = 'A';
|
||||
$beforeRow = 1;
|
||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
|
||||
|
||||
// Get coordinates
|
||||
$newColumn = 'A';
|
||||
$newRow = 1;
|
||||
// Get coordinates of $pCellReference
|
||||
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference );
|
||||
|
||||
// Make sure the reference can be used
|
||||
if ($newColumn == '' && $newRow == '')
|
||||
{
|
||||
return $pCellReference;
|
||||
}
|
||||
|
||||
// Verify which parts should be updated
|
||||
$updateColumn = (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn))
|
||||
&& (strpos($newColumn, '$') === false)
|
||||
&& (strpos($beforeColumn, '$') === false);
|
||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
||||
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
||||
|
||||
$updateRow = ($newRow >= $beforeRow)
|
||||
&& (strpos($newRow, '$') === false)
|
||||
&& (strpos($beforeRow, '$') === false);
|
||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
||||
$newRow >= $beforeRow);
|
||||
|
||||
// Create new column reference
|
||||
if ($updateColumn) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText implements PHPExcel_IComparable
|
||||
{
|
||||
|
@@ -18,9 +18,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
@@ -18,9 +18,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
@@ -18,9 +18,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_RichText
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Settings
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/** PHPExcel root directory */
|
||||
@@ -32,17 +32,45 @@ if (!defined('PHPEXCEL_ROOT')) {
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
PHPExcel_Autoloader::Register();
|
||||
PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PHPExcel_Settings
|
||||
{
|
||||
/** constants */
|
||||
const PCLZIP = 'PHPExcel_Shared_ZipArchive';
|
||||
const ZIPARCHIVE = 'ZipArchive';
|
||||
|
||||
|
||||
private static $_zipClass = self::ZIPARCHIVE;
|
||||
|
||||
|
||||
/**
|
||||
* Set the Zip Class to use (PCLZip or ZipArchive)
|
||||
*
|
||||
* @param string $zipClass PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setZipClass($zipClass) {
|
||||
if (($zipClass == self::PCLZIP) ||
|
||||
($zipClass == self::ZIPARCHIVE)) {
|
||||
self::$_zipClass = $zipClass;
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
} // function setZipClass()
|
||||
|
||||
|
||||
/**
|
||||
* Return the Zip Class to use (PCLZip or ZipArchive)
|
||||
*
|
||||
* @return string Zip Class to use - PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
|
||||
*/
|
||||
public static function getZipClass() {
|
||||
return self::$_zipClass;
|
||||
} // function getZipClass()
|
||||
|
||||
|
||||
public static function getCacheStorageMethod() {
|
||||
return PHPExcel_CachedObjectStorageFactory::$_cacheStorageMethod;
|
||||
} // function getCacheStorageMethod()
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_CodePage
|
||||
{
|
||||
@@ -46,46 +46,47 @@ class PHPExcel_Shared_CodePage
|
||||
public static function NumberToName($codePage = '1252')
|
||||
{
|
||||
switch ($codePage) {
|
||||
case 367: return 'ASCII'; break; // ASCII
|
||||
case 437: return 'CP437'; break; //OEM US
|
||||
case 367: return 'ASCII'; break; // ASCII
|
||||
case 437: return 'CP437'; break; // OEM US
|
||||
case 720: throw new Exception('Code page 720 not supported.');
|
||||
break; //OEM Arabic
|
||||
case 737: return 'CP737'; break; //OEM Greek
|
||||
case 775: return 'CP775'; break; //OEM Baltic
|
||||
case 850: return 'CP850'; break; //OEM Latin I
|
||||
case 852: return 'CP852'; break; //OEM Latin II (Central European)
|
||||
case 855: return 'CP855'; break; //OEM Cyrillic
|
||||
case 857: return 'CP857'; break; //OEM Turkish
|
||||
case 858: return 'CP858'; break; //OEM Multilingual Latin I with Euro
|
||||
case 860: return 'CP860'; break; //OEM Portugese
|
||||
case 861: return 'CP861'; break; //OEM Icelandic
|
||||
case 862: return 'CP862'; break; //OEM Hebrew
|
||||
case 863: return 'CP863'; break; //OEM Canadian (French)
|
||||
case 864: return 'CP864'; break; //OEM Arabic
|
||||
case 865: return 'CP865'; break; //OEM Nordic
|
||||
case 866: return 'CP866'; break; //OEM Cyrillic (Russian)
|
||||
case 869: return 'CP869'; break; //OEM Greek (Modern)
|
||||
case 874: return 'CP874'; break; //ANSI Thai
|
||||
case 932: return 'CP932'; break; //ANSI Japanese Shift-JIS
|
||||
case 936: return 'CP936'; break; //ANSI Chinese Simplified GBK
|
||||
case 949: return 'CP949'; break; //ANSI Korean (Wansung)
|
||||
case 950: return 'CP950'; break; //ANSI Chinese Traditional BIG5
|
||||
case 1200: return 'UTF-16LE'; break; //UTF-16 (BIFF8)
|
||||
case 1250: return 'CP1250'; break; // ANSI Latin II (Central European)
|
||||
case 1251: return 'CP1251'; break; //ANSI Cyrillic
|
||||
case 1252: return 'CP1252'; break; //ANSI Latin I (BIFF4-BIFF7)
|
||||
case 1253: return 'CP1253'; break; //ANSI Greek
|
||||
case 1254: return 'CP1254'; break; //ANSI Turkish
|
||||
case 1255: return 'CP1255'; break; //ANSI Hebrew
|
||||
case 1256: return 'CP1256'; break; //ANSI Arabic
|
||||
case 1257: return 'CP1257'; break; //ANSI Baltic
|
||||
case 1258: return 'CP1258'; break; //ANSI Vietnamese
|
||||
case 1361: return 'CP1361'; break; //ANSI Korean (Johab)
|
||||
case 10000: return 'MAC'; break; //Apple Roman
|
||||
case 32768: return 'MAC'; break; //Apple Roman
|
||||
break; // OEM Arabic
|
||||
case 737: return 'CP737'; break; // OEM Greek
|
||||
case 775: return 'CP775'; break; // OEM Baltic
|
||||
case 850: return 'CP850'; break; // OEM Latin I
|
||||
case 852: return 'CP852'; break; // OEM Latin II (Central European)
|
||||
case 855: return 'CP855'; break; // OEM Cyrillic
|
||||
case 857: return 'CP857'; break; // OEM Turkish
|
||||
case 858: return 'CP858'; break; // OEM Multilingual Latin I with Euro
|
||||
case 860: return 'CP860'; break; // OEM Portugese
|
||||
case 861: return 'CP861'; break; // OEM Icelandic
|
||||
case 862: return 'CP862'; break; // OEM Hebrew
|
||||
case 863: return 'CP863'; break; // OEM Canadian (French)
|
||||
case 864: return 'CP864'; break; // OEM Arabic
|
||||
case 865: return 'CP865'; break; // OEM Nordic
|
||||
case 866: return 'CP866'; break; // OEM Cyrillic (Russian)
|
||||
case 869: return 'CP869'; break; // OEM Greek (Modern)
|
||||
case 874: return 'CP874'; break; // ANSI Thai
|
||||
case 932: return 'CP932'; break; // ANSI Japanese Shift-JIS
|
||||
case 936: return 'CP936'; break; // ANSI Chinese Simplified GBK
|
||||
case 949: return 'CP949'; break; // ANSI Korean (Wansung)
|
||||
case 950: return 'CP950'; break; // ANSI Chinese Traditional BIG5
|
||||
case 1200: return 'UTF-16LE'; break; // UTF-16 (BIFF8)
|
||||
case 1250: return 'CP1250'; break; // ANSI Latin II (Central European)
|
||||
case 1251: return 'CP1251'; break; // ANSI Cyrillic
|
||||
case 0: // CodePage is not always correctly set when the xls file was saved by Apple's Numbers program
|
||||
case 1252: return 'CP1252'; break; // ANSI Latin I (BIFF4-BIFF7)
|
||||
case 1253: return 'CP1253'; break; // ANSI Greek
|
||||
case 1254: return 'CP1254'; break; // ANSI Turkish
|
||||
case 1255: return 'CP1255'; break; // ANSI Hebrew
|
||||
case 1256: return 'CP1256'; break; // ANSI Arabic
|
||||
case 1257: return 'CP1257'; break; // ANSI Baltic
|
||||
case 1258: return 'CP1258'; break; // ANSI Vietnamese
|
||||
case 1361: return 'CP1361'; break; // ANSI Korean (Johab)
|
||||
case 10000: return 'MAC'; break; // Apple Roman
|
||||
case 32768: return 'MAC'; break; // Apple Roman
|
||||
case 32769: throw new Exception('Code page 32769 not supported.');
|
||||
break; //ANSI Latin I (BIFF2-BIFF3)
|
||||
case 65001: return 'UTF-8'; break; //Unicode (UTF-8)
|
||||
break; // ANSI Latin I (BIFF2-BIFF3)
|
||||
case 65001: return 'UTF-8'; break; // Unicode (UTF-8)
|
||||
}
|
||||
|
||||
throw new Exception('Unknown codepage: ' . $codePage);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -21,9 +21,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Date
|
||||
{
|
||||
@@ -220,7 +220,7 @@ class PHPExcel_Shared_Date
|
||||
} // function isDateTimeFormat()
|
||||
|
||||
|
||||
private static $possibleDateFormatCharacters = 'ymdHis';
|
||||
private static $possibleDateFormatCharacters = 'ymdHs';
|
||||
|
||||
/**
|
||||
* Is a given number format code a date/time?
|
||||
@@ -256,8 +256,24 @@ class PHPExcel_Shared_Date
|
||||
return true;
|
||||
}
|
||||
|
||||
// Typically number, currency or accounting (or occasionally fraction) formats
|
||||
if ((substr($pFormatCode,0,1) == '_') || (substr($pFormatCode,0,2) == '0 ')) {
|
||||
return false;
|
||||
}
|
||||
// Try checking for any of the date formatting characters that don't appear within square braces
|
||||
if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) {
|
||||
// We might also have a format mask containing quoted strings...
|
||||
// we don't want to test for any of our characters within the quoted blocks
|
||||
if (strpos($pFormatCode,'"') !== false) {
|
||||
$i = false;
|
||||
foreach(explode('"',$pFormatCode) as $subVal) {
|
||||
// Only test in alternate array entries (the non-quoted blocks)
|
||||
if (($i = !$i) && (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -273,31 +289,27 @@ class PHPExcel_Shared_Date
|
||||
* @return float|false Excel date/time serial value
|
||||
*/
|
||||
public static function stringToExcel($dateValue = '') {
|
||||
// restrict to dates and times like these because date_parse accepts too many strings
|
||||
// '2009-12-31'
|
||||
// '2009-12-31 15:59'
|
||||
// '2009-12-31 15:59:10'
|
||||
if (!preg_match('/^\d{4}\-\d{1,2}\-\d{1,2}( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/', $dateValue)) {
|
||||
if (strlen($dateValue) < 2)
|
||||
return false;
|
||||
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
|
||||
return false;
|
||||
|
||||
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
|
||||
|
||||
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
|
||||
return false;
|
||||
} else {
|
||||
if (strpos($dateValue, ':') !== false) {
|
||||
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
|
||||
if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
|
||||
return false;
|
||||
}
|
||||
$dateValueNew += $timeValue;
|
||||
}
|
||||
return $dateValueNew;
|
||||
}
|
||||
|
||||
// now try with date_parse
|
||||
$PHPDateArray = date_parse($dateValue);
|
||||
|
||||
if ($PHPDateArray['error_count'] == 0) {
|
||||
$year = $PHPDateArray['year'] !== false ? $PHPDateArray['year'] : self::getExcelCalendar();
|
||||
$month = $PHPDateArray['month'] !== false ? $PHPDateArray['month'] : 1;
|
||||
$day = $PHPDateArray['day'] !== false ? $PHPDateArray['day'] : 0;
|
||||
$hour = $PHPDateArray['hour'] !== false ? $PHPDateArray['hour'] : 0;
|
||||
$minute = $PHPDateArray['minute'] !== false ? $PHPDateArray['minute'] : 0;
|
||||
$second = $PHPDateArray['second'] !== false ? $PHPDateArray['second'] : 0;
|
||||
|
||||
$excelDateValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
|
||||
|
||||
return $excelDateValue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Drawing
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Escher
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Excel5
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_File
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_Font
|
||||
{
|
||||
|
@@ -18,7 +18,10 @@
|
||||
* @version 1.1
|
||||
* @license PHP v3.0
|
||||
*/
|
||||
class LUDecomposition {
|
||||
class PHPExcel_Shared_JAMA_LUDecomposition {
|
||||
|
||||
const MatrixSingularException = "Can only perform operation on singular matrix.";
|
||||
const MatrixSquareException = "Mismatched Row dimension";
|
||||
|
||||
/**
|
||||
* Decomposition storage
|
||||
@@ -58,9 +61,9 @@ class LUDecomposition {
|
||||
* @return Structure to access L, U and piv.
|
||||
*/
|
||||
public function __construct($A) {
|
||||
if ($A instanceof Matrix) {
|
||||
if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
// Use a "left-looking", dot-product, Crout/Doolittle algorithm.
|
||||
$this->LU = $A->getArrayCopy();
|
||||
$this->LU = $A->getArray();
|
||||
$this->m = $A->getRowDimension();
|
||||
$this->n = $A->getColumnDimension();
|
||||
for ($i = 0; $i < $this->m; ++$i) {
|
||||
@@ -112,7 +115,7 @@ class LUDecomposition {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(ArgumentTypeException));
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
@@ -134,7 +137,7 @@ class LUDecomposition {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Matrix($L);
|
||||
return new PHPExcel_Shared_JAMA_Matrix($L);
|
||||
} // function getL()
|
||||
|
||||
|
||||
@@ -153,7 +156,7 @@ class LUDecomposition {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Matrix($U);
|
||||
return new PHPExcel_Shared_JAMA_Matrix($U);
|
||||
} // function getU()
|
||||
|
||||
|
||||
@@ -205,7 +208,7 @@ class LUDecomposition {
|
||||
}
|
||||
return $d;
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixDimensionException));
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||
}
|
||||
} // function det()
|
||||
|
||||
@@ -245,11 +248,11 @@ class LUDecomposition {
|
||||
}
|
||||
return $X;
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixSingularException));
|
||||
throw new Exception(self::MatrixSingularException);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixSquareException));
|
||||
throw new Exception(self::MatrixSquareException);
|
||||
}
|
||||
} // function solve()
|
||||
|
||||
} // class LUDecomposition
|
||||
} // class PHPExcel_Shared_JAMA_LUDecomposition
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,9 @@
|
||||
* @license PHP v3.0
|
||||
* @version 1.1
|
||||
*/
|
||||
class QRDecomposition {
|
||||
class PHPExcel_Shared_JAMA_QRDecomposition {
|
||||
|
||||
const MatrixRankException = "Can only perform operation on full-rank matrix.";
|
||||
|
||||
/**
|
||||
* Array for internal storage of decomposition.
|
||||
@@ -50,7 +52,7 @@ class QRDecomposition {
|
||||
* @return Structure to access R and the Householder vectors and compute Q.
|
||||
*/
|
||||
public function __construct($A) {
|
||||
if($A instanceof Matrix) {
|
||||
if($A instanceof PHPExcel_Shared_JAMA_Matrix) {
|
||||
// Initialize.
|
||||
$this->QR = $A->getArrayCopy();
|
||||
$this->m = $A->getRowDimension();
|
||||
@@ -86,7 +88,7 @@ class QRDecomposition {
|
||||
$this->Rdiag[$k] = -$nrm;
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(ArgumentTypeException));
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
|
||||
}
|
||||
} // function __construct()
|
||||
|
||||
@@ -121,7 +123,7 @@ class QRDecomposition {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Matrix($H);
|
||||
return new PHPExcel_Shared_JAMA_Matrix($H);
|
||||
} // function getH()
|
||||
|
||||
|
||||
@@ -142,7 +144,7 @@ class QRDecomposition {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Matrix($R);
|
||||
return new PHPExcel_Shared_JAMA_Matrix($R);
|
||||
} // function getR()
|
||||
|
||||
|
||||
@@ -179,7 +181,7 @@ class QRDecomposition {
|
||||
}
|
||||
}
|
||||
*/
|
||||
return new Matrix($Q);
|
||||
return new PHPExcel_Shared_JAMA_Matrix($Q);
|
||||
} // function getQ()
|
||||
|
||||
|
||||
@@ -219,14 +221,14 @@ class QRDecomposition {
|
||||
}
|
||||
}
|
||||
}
|
||||
$X = new Matrix($X);
|
||||
$X = new PHPExcel_Shared_JAMA_Matrix($X);
|
||||
return ($X->getMatrix(0, $this->n-1, 0, $nx));
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixRankException));
|
||||
throw new Exception(self::MatrixRankException);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(JAMAError(MatrixDimensionException));
|
||||
throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
|
||||
}
|
||||
} // function solve()
|
||||
|
||||
} // class QRDecomposition
|
||||
} // PHPExcel_Shared_JAMA_class QRDecomposition
|
||||
|
@@ -111,36 +111,36 @@ class PHPExcel_Shared_OLE
|
||||
throw new Exception("Only Little-Endian encoding is supported.");
|
||||
}
|
||||
// Size of blocks and short blocks in bytes
|
||||
$this->bigBlockSize = pow(2, $this->_readInt2($fh));
|
||||
$this->smallBlockSize = pow(2, $this->_readInt2($fh));
|
||||
$this->bigBlockSize = pow(2, self::_readInt2($fh));
|
||||
$this->smallBlockSize = pow(2, self::_readInt2($fh));
|
||||
|
||||
// Skip UID, revision number and version number
|
||||
fseek($fh, 44);
|
||||
// Number of blocks in Big Block Allocation Table
|
||||
$bbatBlockCount = $this->_readInt4($fh);
|
||||
$bbatBlockCount = self::_readInt4($fh);
|
||||
|
||||
// Root chain 1st block
|
||||
$directoryFirstBlockId = $this->_readInt4($fh);
|
||||
$directoryFirstBlockId = self::_readInt4($fh);
|
||||
|
||||
// Skip unused bytes
|
||||
fseek($fh, 56);
|
||||
// Streams shorter than this are stored using small blocks
|
||||
$this->bigBlockThreshold = $this->_readInt4($fh);
|
||||
$this->bigBlockThreshold = self::_readInt4($fh);
|
||||
// Block id of first sector in Short Block Allocation Table
|
||||
$sbatFirstBlockId = $this->_readInt4($fh);
|
||||
$sbatFirstBlockId = self::_readInt4($fh);
|
||||
// Number of blocks in Short Block Allocation Table
|
||||
$sbbatBlockCount = $this->_readInt4($fh);
|
||||
$sbbatBlockCount = self::_readInt4($fh);
|
||||
// Block id of first sector in Master Block Allocation Table
|
||||
$mbatFirstBlockId = $this->_readInt4($fh);
|
||||
$mbatFirstBlockId = self::_readInt4($fh);
|
||||
// Number of blocks in Master Block Allocation Table
|
||||
$mbbatBlockCount = $this->_readInt4($fh);
|
||||
$mbbatBlockCount = self::_readInt4($fh);
|
||||
$this->bbat = array();
|
||||
|
||||
// Remaining 4 * 109 bytes of current block is beginning of Master
|
||||
// Block Allocation Table
|
||||
$mbatBlocks = array();
|
||||
for ($i = 0; $i < 109; ++$i) {
|
||||
$mbatBlocks[] = $this->_readInt4($fh);
|
||||
$mbatBlocks[] = self::_readInt4($fh);
|
||||
}
|
||||
|
||||
// Read rest of Master Block Allocation Table (if any is left)
|
||||
@@ -148,10 +148,10 @@ class PHPExcel_Shared_OLE
|
||||
for ($i = 0; $i < $mbbatBlockCount; ++$i) {
|
||||
fseek($fh, $pos);
|
||||
for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
|
||||
$mbatBlocks[] = $this->_readInt4($fh);
|
||||
$mbatBlocks[] = self::_readInt4($fh);
|
||||
}
|
||||
// Last block id in each block points to next block
|
||||
$pos = $this->_getBlockOffset($this->_readInt4($fh));
|
||||
$pos = $this->_getBlockOffset(self::_readInt4($fh));
|
||||
}
|
||||
|
||||
// Read Big Block Allocation Table according to chain specified by
|
||||
@@ -160,7 +160,7 @@ class PHPExcel_Shared_OLE
|
||||
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
||||
fseek($fh, $pos);
|
||||
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
|
||||
$this->bbat[] = $this->_readInt4($fh);
|
||||
$this->bbat[] = self::_readInt4($fh);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class PHPExcel_Shared_OLE
|
||||
$shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
|
||||
$sbatFh = $this->getStream($sbatFirstBlockId);
|
||||
for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
|
||||
$this->sbat[$blockId] = $this->_readInt4($sbatFh);
|
||||
$this->sbat[$blockId] = self::_readInt4($sbatFh);
|
||||
}
|
||||
fclose($sbatFh);
|
||||
|
||||
@@ -225,7 +225,7 @@ class PHPExcel_Shared_OLE
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function _readInt1($fh)
|
||||
private static function _readInt1($fh)
|
||||
{
|
||||
list(, $tmp) = unpack("c", fread($fh, 1));
|
||||
return $tmp;
|
||||
@@ -237,7 +237,7 @@ class PHPExcel_Shared_OLE
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function _readInt2($fh)
|
||||
private static function _readInt2($fh)
|
||||
{
|
||||
list(, $tmp) = unpack("v", fread($fh, 2));
|
||||
return $tmp;
|
||||
@@ -249,7 +249,7 @@ class PHPExcel_Shared_OLE
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function _readInt4($fh)
|
||||
private static function _readInt4($fh)
|
||||
{
|
||||
list(, $tmp) = unpack("V", fread($fh, 4));
|
||||
return $tmp;
|
||||
@@ -269,11 +269,11 @@ class PHPExcel_Shared_OLE
|
||||
for ($pos = 0; ; $pos += 128) {
|
||||
fseek($fh, $pos, SEEK_SET);
|
||||
$nameUtf16 = fread($fh, 64);
|
||||
$nameLength = $this->_readInt2($fh);
|
||||
$nameLength = self::_readInt2($fh);
|
||||
$nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
|
||||
// Simple conversion from UTF-16LE to ISO-8859-1
|
||||
$name = str_replace("\x00", "", $nameUtf16);
|
||||
$type = $this->_readInt1($fh);
|
||||
$type = self::_readInt1($fh);
|
||||
switch ($type) {
|
||||
case self::OLE_PPS_TYPE_ROOT:
|
||||
$pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
|
||||
@@ -292,14 +292,14 @@ class PHPExcel_Shared_OLE
|
||||
fseek($fh, 1, SEEK_CUR);
|
||||
$pps->Type = $type;
|
||||
$pps->Name = $name;
|
||||
$pps->PrevPps = $this->_readInt4($fh);
|
||||
$pps->NextPps = $this->_readInt4($fh);
|
||||
$pps->DirPps = $this->_readInt4($fh);
|
||||
$pps->PrevPps = self::_readInt4($fh);
|
||||
$pps->NextPps = self::_readInt4($fh);
|
||||
$pps->DirPps = self::_readInt4($fh);
|
||||
fseek($fh, 20, SEEK_CUR);
|
||||
$pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
|
||||
$pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
|
||||
$pps->_StartBlock = $this->_readInt4($fh);
|
||||
$pps->Size = $this->_readInt4($fh);
|
||||
$pps->_StartBlock = self::_readInt4($fh);
|
||||
$pps->Size = self::_readInt4($fh);
|
||||
$pps->No = count($this->_list);
|
||||
$this->_list[] = $pps;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2010 PHPExcel
|
||||
* Copyright (C) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -22,7 +22,7 @@
|
||||
* @package PHPExcel_Shared_OLE
|
||||
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@@ -169,10 +169,8 @@ class PHPExcel_Shared_OLE_PPS
|
||||
*/
|
||||
public function _getPpsWk()
|
||||
{
|
||||
$ret = $this->Name;
|
||||
for ($i = 0; $i < (64 - strlen($this->Name)); ++$i) {
|
||||
$ret .= "\x00";
|
||||
}
|
||||
$ret = str_pad($this->Name,64,"\x00");
|
||||
|
||||
$ret .= pack("v", strlen($this->Name) + 2) // 66
|
||||
. pack("c", $this->Type) // 67
|
||||
. pack("c", 0x00) //UK // 68
|
||||
@@ -215,4 +213,4 @@ class PHPExcel_Shared_OLE_PPS
|
||||
}
|
||||
return $this->No;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,12 +29,21 @@
|
||||
*/
|
||||
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
|
||||
/**
|
||||
* Directory for temporary files
|
||||
* @var string
|
||||
*/
|
||||
protected $_tmp_dir = '';
|
||||
|
||||
/**
|
||||
* @param integer $time_1st A timestamp
|
||||
* @param integer $time_2nd A timestamp
|
||||
*/
|
||||
public function __construct($time_1st, $time_2nd, $raChild)
|
||||
{
|
||||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
|
||||
parent::__construct(
|
||||
null,
|
||||
PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'),
|
||||
@@ -63,9 +72,9 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
{
|
||||
// Initial Setting for saving
|
||||
$this->_BIG_BLOCK_SIZE = pow(2,
|
||||
((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9));
|
||||
((isset($this->_BIG_BLOCK_SIZE))? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9));
|
||||
$this->_SMALL_BLOCK_SIZE= pow(2,
|
||||
((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6));
|
||||
((isset($this->_SMALL_BLOCK_SIZE))? self::_adjust2($this->_SMALL_BLOCK_SIZE): 6));
|
||||
|
||||
if (is_resource($filename)) {
|
||||
$this->_FILEH_ = $filename;
|
||||
@@ -119,7 +128,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
|
||||
$iSmallLen = 0;
|
||||
$iSBcnt = 0;
|
||||
for ($i = 0; $i < count($raList); ++$i) {
|
||||
$iCount = count($raList);
|
||||
for ($i = 0; $i < $iCount; ++$i) {
|
||||
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
||||
$raList[$i]->Size = $raList[$i]->_DataLen();
|
||||
if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
|
||||
@@ -151,7 +161,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
* @see save()
|
||||
* @return integer
|
||||
*/
|
||||
public function _adjust2($i2)
|
||||
private static function _adjust2($i2)
|
||||
{
|
||||
$iWk = log($i2)/log(2);
|
||||
return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
|
||||
@@ -229,7 +239,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
fwrite($FILE, pack("V", $iAll+$i));
|
||||
}
|
||||
if ($i < $i1stBdL) {
|
||||
for ($j = 0; $j < ($i1stBdL-$i); ++$j) {
|
||||
$jB = $i1stBdL - $i;
|
||||
for ($j = 0; $j < $jB; ++$j) {
|
||||
fwrite($FILE, (pack("V", -1)));
|
||||
}
|
||||
}
|
||||
@@ -247,7 +258,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$FILE = $this->_FILEH_;
|
||||
|
||||
// cycle through PPS's
|
||||
for ($i = 0; $i < count($raList); ++$i) {
|
||||
$iCount = count($raList);
|
||||
for ($i = 0; $i < $iCount; ++$i) {
|
||||
if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
|
||||
$raList[$i]->Size = $raList[$i]->_DataLen();
|
||||
if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
|
||||
@@ -266,9 +278,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
//}
|
||||
|
||||
if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
|
||||
for ($j = 0; $j < ($this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)); ++$j) {
|
||||
fwrite($FILE, "\x00");
|
||||
}
|
||||
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
|
||||
}
|
||||
// Set For PPS
|
||||
$raList[$i]->_StartBlock = $iStBlk;
|
||||
@@ -298,7 +308,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$FILE = $this->_FILEH_;
|
||||
$iSmBlk = 0;
|
||||
|
||||
for ($i = 0; $i < count($raList); ++$i) {
|
||||
$iCount = count($raList);
|
||||
for ($i = 0; $i < $iCount; ++$i) {
|
||||
// Make SBD, small data string
|
||||
if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
|
||||
if ($raList[$i]->Size <= 0) {
|
||||
@@ -308,7 +319,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
||||
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
|
||||
// Add to SBD
|
||||
for ($j = 0; $j < ($iSmbCnt-1); ++$j) {
|
||||
$jB = $iSmbCnt - 1;
|
||||
for ($j = 0; $j < $jB; ++$j) {
|
||||
fwrite($FILE, pack("V", $j+$iSmBlk+1));
|
||||
}
|
||||
fwrite($FILE, pack("V", -2));
|
||||
@@ -323,9 +335,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
$sRes .= $raList[$i]->_data;
|
||||
//}
|
||||
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
||||
for ($j = 0; $j < ($this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)); ++$j) {
|
||||
$sRes .= "\x00";
|
||||
}
|
||||
$sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
||||
}
|
||||
// Set for PPS
|
||||
$raList[$i]->_StartBlock = $iSmBlk;
|
||||
@@ -335,7 +345,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
}
|
||||
$iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
|
||||
if ($iSmBlk % $iSbCnt) {
|
||||
for ($i = 0; $i < ($iSbCnt - ($iSmBlk % $iSbCnt)); ++$i) {
|
||||
$iB = $iSbCnt - ($iSmBlk % $iSbCnt);
|
||||
for ($i = 0; $i < $iB; ++$i) {
|
||||
fwrite($FILE, pack("V", -1));
|
||||
}
|
||||
}
|
||||
@@ -351,16 +362,15 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
public function _savePps(&$raList)
|
||||
{
|
||||
// Save each PPS WK
|
||||
for ($i = 0; $i < count($raList); ++$i) {
|
||||
$iC = count($raList);
|
||||
for ($i = 0; $i < $iC; ++$i) {
|
||||
fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
|
||||
}
|
||||
// Adjust for Block
|
||||
$iCnt = count($raList);
|
||||
$iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
|
||||
if ($iCnt % $iBCnt) {
|
||||
for ($i = 0; $i < (($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE); ++$i) {
|
||||
fwrite($this->_FILEH_, "\x00");
|
||||
}
|
||||
fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +436,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
}
|
||||
// Adjust for Block
|
||||
if (($iAllW + $iBdCnt) % $iBbCnt) {
|
||||
for ($i = 0; $i < ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt)); ++$i) {
|
||||
$iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
|
||||
for ($i = 0; $i < $iBlock; ++$i) {
|
||||
fwrite($FILE, pack("V", -1));
|
||||
}
|
||||
}
|
||||
@@ -443,11 +454,12 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||
fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
|
||||
}
|
||||
if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
|
||||
for ($i = 0; $i < (($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1))); ++$i) {
|
||||
$iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
|
||||
for ($i = 0; $i < $iB; ++$i) {
|
||||
fwrite($FILE, pack("V", -1));
|
||||
}
|
||||
}
|
||||
fwrite($FILE, pack("V", -2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
|
||||
@@ -59,6 +59,13 @@ class PHPExcel_Shared_OLERead {
|
||||
const START_BLOCK_POS = 0x74;
|
||||
const SIZE_POS = 0x78;
|
||||
|
||||
|
||||
|
||||
public $wrkbook = null;
|
||||
public $summaryInformation = null;
|
||||
public $documentSummaryInformation = null;
|
||||
|
||||
|
||||
/**
|
||||
* Read the file
|
||||
*
|
||||
@@ -81,19 +88,19 @@ class PHPExcel_Shared_OLERead {
|
||||
}
|
||||
|
||||
// Total number of sectors used for the SAT
|
||||
$this->numBigBlockDepotBlocks = $this->_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
|
||||
$this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
|
||||
|
||||
// SecID of the first sector of the directory stream
|
||||
$this->rootStartBlock = $this->_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
|
||||
$this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
|
||||
|
||||
// SecID of the first sector of the SSAT (or -2 if not extant)
|
||||
$this->sbdStartBlock = $this->_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
|
||||
$this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
|
||||
|
||||
// SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
|
||||
$this->extensionBlock = $this->_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
|
||||
$this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
|
||||
|
||||
// Total number of sectors used by MSAT
|
||||
$this->numExtensionBlocks = $this->_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
|
||||
$this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
|
||||
|
||||
$bigBlockDepotBlocks = array();
|
||||
$pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
|
||||
@@ -105,7 +112,7 @@ class PHPExcel_Shared_OLERead {
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $bbdBlocks; ++$i) {
|
||||
$bigBlockDepotBlocks[$i] = $this->_GetInt4d($this->data, $pos);
|
||||
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
||||
$pos += 4;
|
||||
}
|
||||
|
||||
@@ -114,40 +121,39 @@ class PHPExcel_Shared_OLERead {
|
||||
$blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
|
||||
|
||||
for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
|
||||
$bigBlockDepotBlocks[$i] = $this->_GetInt4d($this->data, $pos);
|
||||
$bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
|
||||
$pos += 4;
|
||||
}
|
||||
|
||||
$bbdBlocks += $blocksToRead;
|
||||
if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
|
||||
$this->extensionBlock = $this->_GetInt4d($this->data, $pos);
|
||||
$this->extensionBlock = self::_GetInt4d($this->data, $pos);
|
||||
}
|
||||
}
|
||||
|
||||
$pos = 0;
|
||||
$index = 0;
|
||||
$pos = $index = 0;
|
||||
$this->bigBlockChain = array();
|
||||
|
||||
$bbs = self::BIG_BLOCK_SIZE / 4;
|
||||
for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
|
||||
$pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
|
||||
|
||||
for ($j = 0 ; $j < self::BIG_BLOCK_SIZE / 4; ++$j) {
|
||||
$this->bigBlockChain[$index] = $this->_GetInt4d($this->data, $pos);
|
||||
for ($j = 0 ; $j < $bbs; ++$j) {
|
||||
$this->bigBlockChain[$index] = self::_GetInt4d($this->data, $pos);
|
||||
$pos += 4 ;
|
||||
++$index;
|
||||
}
|
||||
}
|
||||
|
||||
$pos = 0;
|
||||
$index = 0;
|
||||
$pos = $index = 0;
|
||||
$sbdBlock = $this->sbdStartBlock;
|
||||
$this->smallBlockChain = array();
|
||||
|
||||
while ($sbdBlock != -2) {
|
||||
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
|
||||
|
||||
for ($j = 0; $j < self::BIG_BLOCK_SIZE / 4; ++$j) {
|
||||
$this->smallBlockChain[$index] = $this->_GetInt4d($this->data, $pos);
|
||||
for ($j = 0; $j < $bbs; ++$j) {
|
||||
$this->smallBlockChain[$index] = self::_GetInt4d($this->data, $pos);
|
||||
$pos += 4;
|
||||
++$index;
|
||||
}
|
||||
@@ -155,81 +161,31 @@ class PHPExcel_Shared_OLERead {
|
||||
$sbdBlock = $this->bigBlockChain[$sbdBlock];
|
||||
}
|
||||
|
||||
$block = $this->rootStartBlock;
|
||||
$pos = 0;
|
||||
|
||||
// read the directory stream
|
||||
$block = $this->rootStartBlock;
|
||||
$this->entry = $this->_readData($block);
|
||||
|
||||
$this->_readPropertySets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract binary stream data, workbook stream + sheet streams
|
||||
* Extract binary stream data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWorkBook()
|
||||
public function getStream($stream)
|
||||
{
|
||||
if ($this->props[$this->wrkbook]['size'] < self::SMALL_BLOCK_THRESHOLD){
|
||||
$rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
|
||||
|
||||
$streamData = '';
|
||||
$block = $this->props[$this->wrkbook]['startBlock'];
|
||||
|
||||
$pos = 0;
|
||||
while ($block != -2) {
|
||||
$pos = $block * self::SMALL_BLOCK_SIZE;
|
||||
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
||||
|
||||
$block = $this->smallBlockChain[$block];
|
||||
}
|
||||
|
||||
return $streamData;
|
||||
|
||||
|
||||
} else {
|
||||
$numBlocks = $this->props[$this->wrkbook]['size'] / self::BIG_BLOCK_SIZE;
|
||||
if ($this->props[$this->wrkbook]['size'] % self::BIG_BLOCK_SIZE != 0) {
|
||||
++$numBlocks;
|
||||
}
|
||||
|
||||
if ($numBlocks == 0) return '';
|
||||
|
||||
|
||||
$streamData = '';
|
||||
$block = $this->props[$this->wrkbook]['startBlock'];
|
||||
|
||||
$pos = 0;
|
||||
|
||||
while ($block != -2) {
|
||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||
$block = $this->bigBlockChain[$block];
|
||||
}
|
||||
|
||||
return $streamData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract binary stream data, summary information
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSummaryInformation()
|
||||
{
|
||||
if (!isset($this->summaryInformation)) {
|
||||
if (is_null($stream)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->props[$this->summaryInformation]['size'] < self::SMALL_BLOCK_THRESHOLD){
|
||||
$streamData = '';
|
||||
|
||||
if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
|
||||
$rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
|
||||
|
||||
$streamData = '';
|
||||
$block = $this->props[$this->summaryInformation]['startBlock'];
|
||||
$block = $this->props[$stream]['startBlock'];
|
||||
|
||||
$pos = 0;
|
||||
while ($block != -2) {
|
||||
$pos = $block * self::SMALL_BLOCK_SIZE;
|
||||
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
||||
@@ -238,21 +194,15 @@ class PHPExcel_Shared_OLERead {
|
||||
}
|
||||
|
||||
return $streamData;
|
||||
|
||||
|
||||
} else {
|
||||
$numBlocks = $this->props[$this->summaryInformation]['size'] / self::BIG_BLOCK_SIZE;
|
||||
if ($this->props[$this->summaryInformation]['size'] % self::BIG_BLOCK_SIZE != 0) {
|
||||
$numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
|
||||
if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
|
||||
++$numBlocks;
|
||||
}
|
||||
|
||||
if ($numBlocks == 0) return '';
|
||||
|
||||
|
||||
$streamData = '';
|
||||
$block = $this->props[$this->summaryInformation]['startBlock'];
|
||||
|
||||
$pos = 0;
|
||||
$block = $this->props[$stream]['startBlock'];
|
||||
|
||||
while ($block != -2) {
|
||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||
@@ -273,12 +223,11 @@ class PHPExcel_Shared_OLERead {
|
||||
private function _readData($bl)
|
||||
{
|
||||
$block = $bl;
|
||||
$pos = 0;
|
||||
$data = '';
|
||||
|
||||
while ($block != -2) {
|
||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||
$data = $data . substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||
$block = $this->bigBlockChain[$block];
|
||||
}
|
||||
return $data;
|
||||
@@ -287,12 +236,12 @@ class PHPExcel_Shared_OLERead {
|
||||
/**
|
||||
* Read entries in the directory stream.
|
||||
*/
|
||||
private function _readPropertySets()
|
||||
{
|
||||
private function _readPropertySets() {
|
||||
$offset = 0;
|
||||
|
||||
// loop through entires, each entry is 128 bytes
|
||||
while ($offset < strlen($this->entry)) {
|
||||
$entryLen = strlen($this->entry);
|
||||
while ($offset < $entryLen) {
|
||||
// entry data (128 bytes)
|
||||
$d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
|
||||
|
||||
@@ -304,16 +253,11 @@ class PHPExcel_Shared_OLERead {
|
||||
|
||||
// sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
|
||||
// sectorID of first sector of the short-stream container stream, if this entry is root entry
|
||||
$startBlock = $this->_GetInt4d($d, self::START_BLOCK_POS);
|
||||
$startBlock = self::_GetInt4d($d, self::START_BLOCK_POS);
|
||||
|
||||
$size = $this->_GetInt4d($d, self::SIZE_POS);
|
||||
$size = self::_GetInt4d($d, self::SIZE_POS);
|
||||
|
||||
$name = '';
|
||||
for ($i = 0; $i < $nameSize ; ++$i) {
|
||||
$name .= $d[$i];
|
||||
}
|
||||
|
||||
$name = str_replace("\x00", "", $name);
|
||||
$name = str_replace("\x00", "", substr($d,0,$nameSize));
|
||||
|
||||
$this->props[] = array (
|
||||
'name' => $name,
|
||||
@@ -333,9 +277,16 @@ class PHPExcel_Shared_OLERead {
|
||||
|
||||
// Summary information
|
||||
if ($name == chr(5) . 'SummaryInformation') {
|
||||
// echo 'Summary Information<br />';
|
||||
$this->summaryInformation = count($this->props) - 1;
|
||||
}
|
||||
|
||||
// Additional Document Summary information
|
||||
if ($name == chr(5) . 'DocumentSummaryInformation') {
|
||||
// echo 'Document Summary Information<br />';
|
||||
$this->documentSummaryInformation = count($this->props) - 1;
|
||||
}
|
||||
|
||||
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
@@ -348,14 +299,19 @@ class PHPExcel_Shared_OLERead {
|
||||
* @param int $pos
|
||||
* @return int
|
||||
*/
|
||||
private function _GetInt4d($data, $pos)
|
||||
private static function _GetInt4d($data, $pos)
|
||||
{
|
||||
// FIX: represent numbers correctly on 64-bit system
|
||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
|
||||
// Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
|
||||
$_or_24 = ord($data[$pos+3]);
|
||||
if ($_or_24>=128) $_ord_24 = -abs((256-$_or_24) << 24);
|
||||
else $_ord_24 = ($_or_24&127) << 24;
|
||||
|
||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
|
||||
$_or_24 = ord($data[$pos + 3]);
|
||||
if ($_or_24 >= 128) {
|
||||
// negative number
|
||||
$_ord_24 = -abs((256 - $_or_24) << 24);
|
||||
} else {
|
||||
$_ord_24 = ($_or_24 & 127) << 24;
|
||||
}
|
||||
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
|
||||
}
|
||||
|
||||
}
|
||||
|
504
libraries/PHPExcel/PHPExcel/Shared/PCLZip/gnu-lgpl.txt
Normal file
504
libraries/PHPExcel/PHPExcel/Shared/PCLZip/gnu-lgpl.txt
Normal file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
5694
libraries/PHPExcel/PHPExcel/Shared/PCLZip/pclzip.lib.php
Normal file
5694
libraries/PHPExcel/PHPExcel/Shared/PCLZip/pclzip.lib.php
Normal file
File diff suppressed because it is too large
Load Diff
421
libraries/PHPExcel/PHPExcel/Shared/PCLZip/readme.txt
Normal file
421
libraries/PHPExcel/PHPExcel/Shared/PCLZip/readme.txt
Normal file
@@ -0,0 +1,421 @@
|
||||
// --------------------------------------------------------------------------------
|
||||
// PclZip 2.8.2 - readme.txt
|
||||
// --------------------------------------------------------------------------------
|
||||
// License GNU/LGPL - August 2009
|
||||
// Vincent Blavet - vincent@phpconcept.net
|
||||
// http://www.phpconcept.net
|
||||
// --------------------------------------------------------------------------------
|
||||
// $Id: readme.txt,v 1.60 2009/09/30 20:35:21 vblavet Exp $
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
0 - Sommaire
|
||||
============
|
||||
1 - Introduction
|
||||
2 - What's new
|
||||
3 - Corrected bugs
|
||||
4 - Known bugs or limitations
|
||||
5 - License
|
||||
6 - Warning
|
||||
7 - Documentation
|
||||
8 - Author
|
||||
9 - Contribute
|
||||
|
||||
1 - Introduction
|
||||
================
|
||||
|
||||
PclZip is a library that allow you to manage a Zip archive.
|
||||
|
||||
Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
|
||||
|
||||
2 - What's new
|
||||
==============
|
||||
|
||||
Version 2.8.2 :
|
||||
- PCLZIP_CB_PRE_EXTRACT and PCLZIP_CB_POST_EXTRACT are now supported with
|
||||
extraction as a string (PCLZIP_OPT_EXTRACT_AS_STRING). The string
|
||||
can also be modified in the post-extract call back.
|
||||
**Bugs correction :
|
||||
- PCLZIP_OPT_REMOVE_ALL_PATH was not working correctly
|
||||
- Remove use of eval() and do direct call to callback functions
|
||||
- Correct support of 64bits systems (Thanks to WordPress team)
|
||||
|
||||
Version 2.8.1 :
|
||||
- Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
|
||||
deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
|
||||
automatically replace it by PCLZIP_OPT_BY_PREG.
|
||||
|
||||
Version 2.8 :
|
||||
- Improve extraction of zip archive for large files by using temporary files
|
||||
This feature is working like the one defined in r2.7.
|
||||
Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
|
||||
PCLZIP_OPT_TEMP_FILE_THRESHOLD
|
||||
- Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
|
||||
sense of temporary file use.
|
||||
- Bug correction : Reduce filepath in returned file list to remove ennoying
|
||||
'.//' preambule in file path.
|
||||
|
||||
Version 2.7 :
|
||||
- Improve creation of zip archive for large files :
|
||||
PclZip will now autosense the configured memory and use temporary files
|
||||
when large file is suspected.
|
||||
This feature can also ne triggered by manual options in create() and add()
|
||||
methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
|
||||
'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
|
||||
'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
|
||||
threshold to use temporary files.
|
||||
Using "temporary files" rather than "memory" might take more time, but
|
||||
might give the ability to zip very large files :
|
||||
Tested on my win laptop with a 88Mo file :
|
||||
Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
|
||||
Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
|
||||
- Replace use of mktime() by time() to limit the E_STRICT error messages.
|
||||
- Bug correction : When adding files with full windows path (drive letter)
|
||||
PclZip is now working. Before, if the drive letter is not the default
|
||||
path, PclZip was not able to add the file.
|
||||
|
||||
Version 2.6 :
|
||||
- Code optimisation
|
||||
- New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
|
||||
add a comment for a specific file. (Don't really know if this is usefull)
|
||||
- New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
|
||||
as a file.
|
||||
- New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
|
||||
a file.
|
||||
- Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
|
||||
with current time
|
||||
- Add CRC value in the informations returned back for each file after an
|
||||
action.
|
||||
- Add missing closedir() statement.
|
||||
- When adding a folder, and removing the path of this folder, files were
|
||||
incorrectly added with a '/' at the beginning. Which means files are
|
||||
related to root in unix systems. Corrected.
|
||||
- Add conditional if before constant definition. This will allow users
|
||||
to redefine constants without changing the file, and then improve
|
||||
upgrade of pclzip code for new versions.
|
||||
|
||||
Version 2.5 :
|
||||
- Introduce the ability to add file/folder with individual properties (file descriptor).
|
||||
This gives for example the ability to change the filename of a zipped file.
|
||||
. Able to add files individually
|
||||
. Able to change full name
|
||||
. Able to change short name
|
||||
. Compatible with global options
|
||||
- New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
|
||||
- New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
|
||||
- Add a security control feature. PclZip can extract any file in any folder
|
||||
of a system. People may use this to upload a zip file and try to override
|
||||
a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
|
||||
ability to forgive any directory transversal behavior.
|
||||
- New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
|
||||
- New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
|
||||
- Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
|
||||
by current path (getcwd())
|
||||
|
||||
Version 2.4 :
|
||||
- Code improvment : try to speed up the code by removing unusefull call to pack()
|
||||
- Correct bug in delete() : delete() should be called with no argument. This was not
|
||||
the case in 2.3. This is corrected in 2.4.
|
||||
- Correct a bug in path_inclusion function. When the path has several '../../', the
|
||||
result was bad.
|
||||
- Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
|
||||
disable it while working and det it back to its original value.
|
||||
This resolve a lots of bad formated archive errors.
|
||||
- Bug correction : PclZip now correctly unzip file in some specific situation,
|
||||
when compressed content has same size as uncompressed content.
|
||||
- Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
|
||||
directories are not any more created.
|
||||
- Code improvment : correct unclosed opendir(), better handling of . and .. in
|
||||
loops.
|
||||
|
||||
|
||||
Version 2.3 :
|
||||
- Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
|
||||
give the same result in PHP4 and PHP5 ....
|
||||
|
||||
Version 2.2 :
|
||||
- Try development of PCLZIP_OPT_CRYPT .....
|
||||
However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
|
||||
the result (greater than a long) is not supported by PHP. Even the use of bcmath
|
||||
functions does not help. I did not find yet a solution ...;
|
||||
- Add missing '/' at end of directory entries
|
||||
- Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
|
||||
error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
|
||||
- Corrected : Bad "version need to extract" field in local file header
|
||||
- Add private method privCheckFileHeaders() in order to check local and central
|
||||
file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
|
||||
the ability to have a local file header without size, compressed size and crc filled.
|
||||
- Add a generic status 'error' for file status
|
||||
- Add control of compression type. PclZip only support deflate compression method.
|
||||
Before v2.2, PclZip does not check the compression method used in an archive while
|
||||
extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
|
||||
compression method. New status is "unsupported_compression". New error code is
|
||||
PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
|
||||
- Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
|
||||
when errors like 'a folder with same name exists' or 'a newer file exists' or
|
||||
'a write protected file' exists, rather than set a status for the concerning file
|
||||
and resume the extract of the zip.
|
||||
- Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
|
||||
replacement of the file, even if a newer version of the file exists.
|
||||
Note that today if a file with the same name already exists but is older it will be
|
||||
replaced by the extracted one.
|
||||
- Improve PclZipUtilOption()
|
||||
- Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
|
||||
directory structure is the last data in the archive. Crypt encryption/decryption of
|
||||
zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
|
||||
|
||||
Version 2.1 :
|
||||
- Add the ability to abort the extraction by using a user callback function.
|
||||
The user can now return the value '2' in its callback which indicates to stop the
|
||||
extraction. For a pre call-back extract is stopped before the extration of the current
|
||||
file. For a post call back, the extraction is stopped after.
|
||||
- Add the ability to extract a file (or several files) directly in the standard output.
|
||||
This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
|
||||
- Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
|
||||
PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
|
||||
in the zip archive.
|
||||
- When merging two archives, the comments are not any more lost, but merged, with a
|
||||
blank space separator.
|
||||
- Corrected bug : Files are not deleted when all files are asked to be deleted.
|
||||
- Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
|
||||
|
||||
|
||||
Version 2.0 :
|
||||
***** Warning : Some new features may break the backward compatibility for your scripts.
|
||||
Please carefully read the readme file.
|
||||
- Add the ability to delete by Index, name and regular expression. This feature is
|
||||
performed by the method delete(), which uses the optional parameters
|
||||
PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
|
||||
- Add the ability to extract by regular expression. To extract by regexp you must use the method
|
||||
extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
|
||||
(depending if you want to use ereg() or preg_match() syntax) followed by the
|
||||
regular expression pattern.
|
||||
- Add the ability to extract by index, directly with the extract() method. This is a
|
||||
code improvment of the extractByIndex() method.
|
||||
- Add the ability to extract by name. To extract by name you must use the method
|
||||
extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
|
||||
extract or an array of filenames to extract. To extract all a folder, use the folder
|
||||
name rather than the filename with a '/' at the end.
|
||||
- Add the ability to add files without compression. This is done with a new attribute
|
||||
which is PCLZIP_OPT_NO_COMPRESSION.
|
||||
- Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
|
||||
in a string without using any file (or temporary file).
|
||||
- Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
|
||||
The default separator is now a comma (,) and not any more a blank space.
|
||||
THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
|
||||
your script.
|
||||
- Improve algorythm performance by removing the use of temporary files when adding or
|
||||
extracting files in an archive.
|
||||
- Add (correct) detection of empty filename zipping. This can occurs when the removed
|
||||
path is the same
|
||||
as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
|
||||
- Add better support for windows paths (thanks for help from manus@manusfreedom.com).
|
||||
- Corrected bug : When the archive file already exists with size=0, the add() method
|
||||
fails. Corrected in 2.0.
|
||||
- Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
|
||||
- Control the order of index ranges in extract by index feature.
|
||||
- Change the internal management of folders (better handling of internal flag).
|
||||
|
||||
|
||||
Version 1.3 :
|
||||
- Removing the double include check. This is now done by include_once() and require_once()
|
||||
PHP directives.
|
||||
- Changing the error handling mecanism : Remove the use of an external error library.
|
||||
The former PclError...() functions are replaced by internal equivalent methods.
|
||||
By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
|
||||
Introducing the use of constants for error codes rather than integer values. This will help
|
||||
in futur improvment.
|
||||
Introduction of error handling functions like errorCode(), errorName() and errorInfo().
|
||||
- Remove the deprecated use of calling function with arguments passed by reference.
|
||||
- Add the calling of extract(), extractByIndex(), create() and add() functions
|
||||
with variable options rather than fixed arguments.
|
||||
- Add the ability to remove all the file path while extracting or adding,
|
||||
without any need to specify the path to remove.
|
||||
This is available for extract(), extractByIndex(), create() and add() functionS by using
|
||||
the new variable options parameters :
|
||||
- PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
|
||||
- Ability to change the mode of a file after the extraction (chmod()).
|
||||
This is available for extract() and extractByIndex() functionS by using
|
||||
the new variable options parameters.
|
||||
- PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
|
||||
- Ability to definition call-back options. These call-back will be called during the adding,
|
||||
or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
|
||||
- PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
|
||||
can trigerred the change the filename of the extracted file. The user can triggered the
|
||||
skip of the extraction. This is adding a 'skipped' status in the file list result value.
|
||||
- PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
|
||||
Nothing can be triggered from that point.
|
||||
- PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
|
||||
can trigerred the change the stored filename of the added file. The user can triggered the
|
||||
skip of the add. This is adding a 'skipped' status in the file list result value.
|
||||
- PCLZIP_CB_POST_ADD : will be called after each add of a file.
|
||||
Nothing can be triggered from that point.
|
||||
- Two status are added in the file list returned as function result : skipped & filename_too_long
|
||||
'skipped' is used when a call-back function ask for skipping the file.
|
||||
'filename_too_long' is used while adding a file with a too long filename to archive (the file is
|
||||
not added)
|
||||
- Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
|
||||
a directory.
|
||||
- Add a check of the presence of the archive file before some actions (like list, ...)
|
||||
- Add the initialisation of field "index" in header array. This means that by
|
||||
default index will be -1 when not explicitly set by the methods.
|
||||
|
||||
Version 1.2 :
|
||||
- Adding a duplicate function.
|
||||
- Adding a merge function. The merge function is a "quick merge" function,
|
||||
it just append the content of an archive at the end of the first one. There
|
||||
is no check for duplicate files or more recent files.
|
||||
- Improve the search of the central directory end.
|
||||
|
||||
Version 1.1.2 :
|
||||
|
||||
- Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
|
||||
(see License section).
|
||||
- Adding the optional support of a static temporary directory. You will need to configure
|
||||
the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
|
||||
- Improving the rename() function. In some cases rename() does not work (different
|
||||
Filesystems), so it will be replaced by a copy() + unlink() functions.
|
||||
|
||||
Version 1.1.1 :
|
||||
|
||||
- Maintenance release, no new feature.
|
||||
|
||||
Version 1.1 :
|
||||
|
||||
- New method Add() : adding files in the archive
|
||||
- New method ExtractByIndex() : partial extract of the archive, files are identified by
|
||||
their index in the archive
|
||||
- New method DeleteByIndex() : delete some files/folder entries from the archive,
|
||||
files are identified by their index in the archive.
|
||||
- Adding a test of the zlib extension presence. If not present abort the script.
|
||||
|
||||
Version 1.0.1 :
|
||||
|
||||
- No new feature
|
||||
|
||||
|
||||
3 - Corrected bugs
|
||||
==================
|
||||
|
||||
Corrected in Version 2.0 :
|
||||
- Corrected : During an extraction, if a call-back fucntion is used and try to skip
|
||||
a file, all the extraction process is stopped.
|
||||
|
||||
Corrected in Version 1.3 :
|
||||
- Corrected : Support of static synopsis for method extract() is broken.
|
||||
- Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
|
||||
- Corrected : When an extract is done with a remove_path parameter, the entry for
|
||||
the directory with exactly the same path is not skipped/filtered.
|
||||
- Corrected : extractByIndex() and deleteByIndex() were not managing index in the
|
||||
right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
|
||||
is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
|
||||
string and not interger). The sort is temporarilly removed, this means that
|
||||
you must provide a sorted list of index ranges.
|
||||
|
||||
Corrected in Version 1.2 :
|
||||
|
||||
- Nothing.
|
||||
|
||||
Corrected in Version 1.1.2 :
|
||||
|
||||
- Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
|
||||
|
||||
Corrected in Version 1.1.1 :
|
||||
|
||||
- Corrected : When archived file is not compressed (0% compression), the
|
||||
extract method fails.
|
||||
|
||||
Corrected in Version 1.1 :
|
||||
|
||||
- Corrected : Adding a complete tree of folder may result in a bad archive
|
||||
creation.
|
||||
|
||||
Corrected in Version 1.0.1 :
|
||||
|
||||
- Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
|
||||
|
||||
|
||||
4 - Known bugs or limitations
|
||||
=============================
|
||||
|
||||
Please publish bugs reports in SourceForge :
|
||||
http://sourceforge.net/tracker/?group_id=40254&atid=427564
|
||||
|
||||
In Version 2.x :
|
||||
- PclZip does only support file uncompressed or compressed with deflate (compression method 8)
|
||||
- PclZip does not support password protected zip archive
|
||||
- Some concern were seen when changing mtime of a file while archiving.
|
||||
Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
|
||||
|
||||
In Version 1.2 :
|
||||
|
||||
- merge() methods does not check for duplicate files or last date of modifications.
|
||||
|
||||
In Version 1.1 :
|
||||
|
||||
- Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
|
||||
- WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
|
||||
add a file in a PclZip created archive. (Corrected in v.1.2)
|
||||
|
||||
In Version 1.0.1 :
|
||||
|
||||
- Adding a complete tree of folder may result in a bad archive
|
||||
creation. (Corrected in V.1.1).
|
||||
- Path given to methods must be in the unix format (/) and not the Windows format (\).
|
||||
Workaround : Use only / directory separators.
|
||||
- PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
|
||||
added suffix. Files with these names may already exist and may be overwritten.
|
||||
Workaround : none.
|
||||
- PclZip does not check if the zlib extension is present. If it is absent, the zip
|
||||
file is not created and the lib abort without warning.
|
||||
Workaround : enable the zlib extension on the php install
|
||||
|
||||
In Version 1.0 :
|
||||
|
||||
- Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
|
||||
(Corrected in v.1.0.1)
|
||||
- Limitation : Multi-disk zip archive are not supported.
|
||||
|
||||
|
||||
5 - License
|
||||
===========
|
||||
|
||||
Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
|
||||
This library is free, so you can use it at no cost.
|
||||
|
||||
HOWEVER, if you release a script, an application, a library or any kind of
|
||||
code using PclZip library (or a part of it), YOU MUST :
|
||||
- Indicate in the documentation (or a readme file), that your work
|
||||
uses PclZip Library, and make a reference to the author and the web site
|
||||
http://www.phpconcept.net
|
||||
- Gives the ability to the final user to update the PclZip libary.
|
||||
|
||||
I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
|
||||
be aware that someone is using PclZip.
|
||||
|
||||
For more information about GNU/LGPL license : http://www.gnu.org
|
||||
|
||||
6 - Warning
|
||||
=================
|
||||
|
||||
This library and the associated files are non commercial, non professional work.
|
||||
It should not have unexpected results. However if any damage is caused by this software
|
||||
the author can not be responsible.
|
||||
The use of this software is at the risk of the user.
|
||||
|
||||
7 - Documentation
|
||||
=================
|
||||
PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
|
||||
A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
|
||||
|
||||
8 - Author
|
||||
==========
|
||||
|
||||
This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
|
||||
|
||||
9 - Contribute
|
||||
==============
|
||||
If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
|
||||
If you can help in financing PhpConcept hosting service, please go to
|
||||
http://www.phpconcept.net/soutien.php
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_PasswordHasher
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_String
|
||||
{
|
||||
@@ -69,6 +69,13 @@ class PHPExcel_Shared_String
|
||||
*/
|
||||
private static $_thousandsSeparator;
|
||||
|
||||
/**
|
||||
* Currency code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $_currencyCode;
|
||||
|
||||
/**
|
||||
* Is mbstring extension avalable?
|
||||
*
|
||||
@@ -303,7 +310,7 @@ class PHPExcel_Shared_String
|
||||
|
||||
// Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
|
||||
// we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
|
||||
if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
|
||||
if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
|
||||
self::$_isIconvEnabled = false;
|
||||
return false;
|
||||
}
|
||||
@@ -322,6 +329,15 @@ class PHPExcel_Shared_String
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function buildCharacterSets() {
|
||||
if(empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
}
|
||||
if(empty(self::$_SYLKCharacters)) {
|
||||
self::_buildSYLKCharacters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from OpenXML escaped control character to PHP control character
|
||||
*
|
||||
@@ -337,10 +353,6 @@ class PHPExcel_Shared_String
|
||||
* @return string
|
||||
*/
|
||||
public static function ControlCharacterOOXML2PHP($value = '') {
|
||||
if(empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
}
|
||||
|
||||
return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
|
||||
}
|
||||
|
||||
@@ -359,10 +371,6 @@ class PHPExcel_Shared_String
|
||||
* @return string
|
||||
*/
|
||||
public static function ControlCharacterPHP2OOXML($value = '') {
|
||||
if(empty(self::$_controlCharacters)) {
|
||||
self::_buildControlCharacters();
|
||||
}
|
||||
|
||||
return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
|
||||
}
|
||||
|
||||
@@ -491,7 +499,7 @@ class PHPExcel_Shared_String
|
||||
// else, no conversion
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decode UTF-16 encoded strings.
|
||||
*
|
||||
@@ -533,18 +541,15 @@ class PHPExcel_Shared_String
|
||||
public static function CountCharacters($value, $enc = 'UTF-8')
|
||||
{
|
||||
if (self::getIsIconvEnabled()) {
|
||||
$count = iconv_strlen($value, $enc);
|
||||
return $count;
|
||||
return iconv_strlen($value, $enc);
|
||||
}
|
||||
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
$count = mb_strlen($value, $enc);
|
||||
return $count;
|
||||
return mb_strlen($value, $enc);
|
||||
}
|
||||
|
||||
// else strlen
|
||||
$count = strlen($value);
|
||||
return $count;
|
||||
return strlen($value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,18 +563,15 @@ class PHPExcel_Shared_String
|
||||
public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
|
||||
{
|
||||
if (self::getIsIconvEnabled()) {
|
||||
$string = iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
|
||||
return $string;
|
||||
return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
|
||||
}
|
||||
|
||||
if (self::getIsMbstringEnabled()) {
|
||||
$string = mb_substr($pValue, $pStart, $pLength, 'UTF-8');
|
||||
return $string;
|
||||
return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
|
||||
}
|
||||
|
||||
// else substr
|
||||
$string = substr($pValue, $pStart, $pLength);
|
||||
return $string;
|
||||
return substr($pValue, $pStart, $pLength);
|
||||
}
|
||||
|
||||
|
||||
@@ -602,9 +604,8 @@ class PHPExcel_Shared_String
|
||||
$localeconv = localeconv();
|
||||
self::$_decimalSeparator = $localeconv['decimal_point'] != ''
|
||||
? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
|
||||
|
||||
if (self::$_decimalSeparator == '')
|
||||
{
|
||||
|
||||
if (self::$_decimalSeparator == '') {
|
||||
// Default to .
|
||||
self::$_decimalSeparator = '.';
|
||||
}
|
||||
@@ -650,6 +651,38 @@ class PHPExcel_Shared_String
|
||||
self::$_thousandsSeparator = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currency code. If it has not yet been set explicitly, try to obtain the
|
||||
* symbol information from locale.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getCurrencyCode()
|
||||
{
|
||||
if (!isset(self::$_currencyCode)) {
|
||||
$localeconv = localeconv();
|
||||
self::$_currencyCode = $localeconv['currency_symbol'] != ''
|
||||
? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
|
||||
|
||||
if (self::$_currencyCode == '') {
|
||||
// Default to $
|
||||
self::$_currencyCode = '$';
|
||||
}
|
||||
}
|
||||
return self::$_currencyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
|
||||
* to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
|
||||
*
|
||||
* @param string $pValue Character for currency code
|
||||
*/
|
||||
public static function setCurrencyCode($pValue = '$')
|
||||
{
|
||||
self::$_currencyCode = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert SYLK encoded string to UTF-8
|
||||
*
|
||||
@@ -663,10 +696,6 @@ class PHPExcel_Shared_String
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
if(empty(self::$_SYLKCharacters)) {
|
||||
self::_buildSYLKCharacters();
|
||||
}
|
||||
|
||||
foreach (self::$_SYLKCharacters as $k => $v) {
|
||||
$pValue = str_replace($k, $v, $pValue);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,10 +19,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
if (!defined('DATE_W3C')) {
|
||||
@@ -38,21 +38,14 @@ if (!defined('DEBUGMODE_ENABLED')) {
|
||||
* PHPExcel_Shared_XMLWriter
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_XMLWriter {
|
||||
class PHPExcel_Shared_XMLWriter extends XMLWriter {
|
||||
/** Temporary storage method */
|
||||
const STORAGE_MEMORY = 1;
|
||||
const STORAGE_DISK = 2;
|
||||
|
||||
/**
|
||||
* Internal XMLWriter
|
||||
*
|
||||
* @var XMLWriter
|
||||
*/
|
||||
private $_xmlWriter;
|
||||
|
||||
/**
|
||||
* Temporary filename
|
||||
*
|
||||
@@ -66,83 +59,63 @@ class PHPExcel_Shared_XMLWriter {
|
||||
* @param int $pTemporaryStorage Temporary storage location
|
||||
* @param string $pTemporaryStorageFolder Temporary storage folder
|
||||
*/
|
||||
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') {
|
||||
// Create internal XMLWriter
|
||||
$this->_xmlWriter = new XMLWriter();
|
||||
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') {
|
||||
// Open temporary storage
|
||||
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
||||
$this->openMemory();
|
||||
} else {
|
||||
// Create temporary filename
|
||||
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||
|
||||
// Open temporary storage
|
||||
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
|
||||
$this->_xmlWriter->openMemory();
|
||||
} else {
|
||||
// Create temporary filename
|
||||
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
|
||||
// Open storage
|
||||
if ($this->openUri($this->_tempFileName) === false) {
|
||||
// Fallback to memory...
|
||||
$this->openMemory();
|
||||
}
|
||||
}
|
||||
|
||||
// Open storage
|
||||
if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
|
||||
// Fallback to memory...
|
||||
$this->_xmlWriter->openMemory();
|
||||
}
|
||||
}
|
||||
|
||||
// Set default values
|
||||
// Set default values
|
||||
if (DEBUGMODE_ENABLED) {
|
||||
$this->_xmlWriter->setIndent(true);
|
||||
}
|
||||
}
|
||||
$this->setIndent(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
// Desctruct XMLWriter
|
||||
unset($this->_xmlWriter);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct() {
|
||||
// Unlink temporary files
|
||||
if ($this->_tempFileName != '') {
|
||||
@unlink($this->_tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
// Unlink temporary files
|
||||
if ($this->_tempFileName != '') {
|
||||
@unlink($this->_tempFileName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get written data
|
||||
*
|
||||
* @return $data
|
||||
*/
|
||||
public function getData() {
|
||||
if ($this->_tempFileName == '') {
|
||||
return $this->outputMemory(true);
|
||||
} else {
|
||||
$this->flush();
|
||||
return file_get_contents($this->_tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get written data
|
||||
*
|
||||
* @return $data
|
||||
*/
|
||||
public function getData() {
|
||||
if ($this->_tempFileName == '') {
|
||||
return $this->_xmlWriter->outputMemory(true);
|
||||
} else {
|
||||
$this->_xmlWriter->flush();
|
||||
return file_get_contents($this->_tempFileName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fallback method for writeRaw, introduced in PHP 5.2
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public function writeRawData($text)
|
||||
{
|
||||
if (method_exists($this, 'writeRaw')) {
|
||||
return $this->writeRaw(htmlspecialchars($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Catch function calls (and pass them to internal XMLWriter)
|
||||
*
|
||||
* @param unknown_type $function
|
||||
* @param unknown_type $args
|
||||
*/
|
||||
public function __call($function, $args) {
|
||||
try {
|
||||
@call_user_func_array(array($this->_xmlWriter, $function), $args);
|
||||
} catch (Exception $ex) {
|
||||
// Do nothing!
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fallback method for writeRaw, introduced in PHP 5.2
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public function writeRaw($text)
|
||||
{
|
||||
if (isset($this->_xmlWriter) && is_object($this->_xmlWriter) && (method_exists($this->_xmlWriter, 'writeRaw'))) {
|
||||
return $this->_xmlWriter->writeRaw(htmlspecialchars($text));
|
||||
}
|
||||
|
||||
return $this->text($text);
|
||||
}
|
||||
return $this->text($text);
|
||||
}
|
||||
}
|
||||
|
90
libraries/PHPExcel/PHPExcel/Shared/ZipArchive.php
Normal file
90
libraries/PHPExcel/PHPExcel/Shared/ZipArchive.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_ZipArchive
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Shared_ZipArchive
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_ZipArchive
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_ZipArchive
|
||||
{
|
||||
|
||||
/**
|
||||
* Temporary storage directory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_tempDir;
|
||||
|
||||
/**
|
||||
* Zip Archive Stream Handle
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_zip;
|
||||
|
||||
|
||||
public function open($fileName)
|
||||
{
|
||||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
|
||||
$this->_zip = new PclZip($fileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function addFromString($localname, $contents)
|
||||
{
|
||||
$filenameParts = pathinfo($localname);
|
||||
|
||||
$handle = fopen($this->_tempDir.'/'.$filenameParts["basename"], "wb");
|
||||
fwrite($handle, $contents);
|
||||
fclose($handle);
|
||||
|
||||
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
|
||||
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
|
||||
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
|
||||
);
|
||||
if ($res == 0) {
|
||||
throw new Exception("Error zipping files : " . $this->_zip->errorInfo(true));
|
||||
}
|
||||
|
||||
unlink($this->_tempDir.'/'.$filenameParts["basename"]);
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Shared_ZipStreamWrapper {
|
||||
/**
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Best_Fit
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||
{
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
* Copyright (c) 2006 - 2011 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.4, 2010-08-26
|
||||
* @version 1.7.6, 2011-02-27
|
||||
*/
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Shared_Best_Fit
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user