In-code comments and add data for linked validators example

This commit is contained in:
MarkBaker 2014-08-02 23:57:53 +01:00
parent 46e0758cbb
commit 0d07a35fe5
7 changed files with 199 additions and 0 deletions

View File

@ -61,6 +61,7 @@ function transpose($value) {
$continentColumn = 'D'; $continentColumn = 'D';
$column = 'F'; $column = 'F';
// Set data for dropdowns
foreach(glob('./data/continents/*') as $key => $filename) { foreach(glob('./data/continents/*') as $key => $filename) {
$continent = pathinfo($filename, PATHINFO_FILENAME); $continent = pathinfo($filename, PATHINFO_FILENAME);
echo "Loading $continent", EOL; echo "Loading $continent", EOL;
@ -87,6 +88,8 @@ foreach(glob('./data/continents/*') as $key => $filename) {
++$column; ++$column;
} }
// Hide the dropdown data
$objPHPExcel->getActiveSheet() $objPHPExcel->getActiveSheet()
->getColumnDimension($continentColumn) ->getColumnDimension($continentColumn)
->setVisible(false); ->setVisible(false);
@ -99,6 +102,7 @@ $objPHPExcel->addNamedRange(
); );
// Set selection cells
$objPHPExcel->getActiveSheet() $objPHPExcel->getActiveSheet()
->setCellValue('A1', 'Continent:'); ->setCellValue('A1', 'Continent:');
$objPHPExcel->getActiveSheet() $objPHPExcel->getActiveSheet()
@ -111,6 +115,7 @@ $objPHPExcel->getActiveSheet()
->getStyle('A1:A3') ->getStyle('A1:A3')
->getFont()->setBold(true); ->getFont()->setBold(true);
// Set linked validators
$objValidation = $objPHPExcel->getActiveSheet() $objValidation = $objPHPExcel->getActiveSheet()
->getCell('B1') ->getCell('B1')
->getDataValidation(); ->getDataValidation();

View File

@ -0,0 +1,54 @@
Algeria
Angola
Benin
Botswana
Burkina
Burundi
Cameroon
Cape Verde
Central African Republic
Chad
Comoros
Congo
Congo, Democratic Republic of
Djibouti
Egypt
Equatorial Guinea
Eritrea
Ethiopia
Gabon
Gambia
Ghana
Guinea
Guinea-Bissau
Ivory Coast
Kenya
Lesotho
Liberia
Libya
Madagascar
Malawi
Mali
Mauritania
Mauritius
Morocco
Mozambique
Namibia
Niger
Nigeria
Rwanda
Sao Tome and Principe
Senegal
Seychelles
Sierra Leone
Somalia
South Africa
South Sudan
Sudan
Swaziland
Tanzania
Togo
Tunisia
Uganda
Zambia
Zimbabwe

View File

@ -0,0 +1,44 @@
Afghanistan
Bahrain
Bangladesh
Bhutan
Brunei
Burma (Myanmar)
Cambodia
China
East Timor
India
Indonesia
Iran
Iraq
Israel
Japan
Jordan
Kazakhstan
Korea, North
Korea, South
Kuwait
Kyrgyzstan
Laos
Lebanon
Malaysia
Maldives
Mongolia
Nepal
Oman
Pakistan
Philippines
Qatar
Russian Federation
Saudi Arabia
Singapore
Sri Lanka
Syria
Tajikistan
Thailand
Turkey
Turkmenistan
United Arab Emirates
Uzbekistan
Vietnam
Yemen

View File

@ -0,0 +1,47 @@
Albania
Andorra
Armenia
Austria
Azerbaijan
Belarus
Belgium
Bosnia and Herzegovina
Bulgaria
Croatia
Cyprus
Czech Republic
Denmark
Estonia
Finland
France
Georgia
Germany
Greece
Hungary
Iceland
Ireland
Italy
Latvia
Liechtenstein
Lithuania
Luxembourg
Macedonia
Malta
Moldova
Monaco
Montenegro
Netherlands
Norway
Poland
Portugal
Romania
San Marino
Serbia
Slovakia
Slovenia
Spain
Sweden
Switzerland
Ukraine
United Kingdom
Vatican City

View File

@ -0,0 +1,23 @@
Antigua and Barbuda
Bahamas
Barbados
Belize
Canada
Costa Rica
Cuba
Dominica
Dominican Republic
El Salvador
Grenada
Guatemala
Haiti
Honduras
Jamaica
Mexico
Nicaragua
Panama
Saint Kitts and Nevis
Saint Lucia
Saint Vincent and the Grenadines
Trinidad and Tobago
United States

View File

@ -0,0 +1,14 @@
Australia
Fiji
Kiribati
Marshall Islands
Micronesia
Nauru
New Zealand
Palau
Papua New Guinea
Samoa
Solomon Islands
Tonga
Tuvalu
Vanuatu

View File

@ -0,0 +1,12 @@
Argentina
Bolivia
Brazil
Chile
Colombia
Ecuador
Guyana
Paraguay
Peru
Suriname
Uruguay
Venezuela