From 0d07a35fe5cc0315010d26f7845365b35f2824e5 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 2 Aug 2014 23:57:53 +0100 Subject: [PATCH] In-code comments and add data for linked validators example --- Examples/39dropdown.php | 5 ++ Examples/data/continents/Africa.txt | 54 ++++++++++++++++++++++ Examples/data/continents/Asia.txt | 44 ++++++++++++++++++ Examples/data/continents/Europe.txt | 47 +++++++++++++++++++ Examples/data/continents/North America.txt | 23 +++++++++ Examples/data/continents/Oceania.txt | 14 ++++++ Examples/data/continents/South America.txt | 12 +++++ 7 files changed, 199 insertions(+) create mode 100644 Examples/data/continents/Africa.txt create mode 100644 Examples/data/continents/Asia.txt create mode 100644 Examples/data/continents/Europe.txt create mode 100644 Examples/data/continents/North America.txt create mode 100644 Examples/data/continents/Oceania.txt create mode 100644 Examples/data/continents/South America.txt diff --git a/Examples/39dropdown.php b/Examples/39dropdown.php index c8e6b1b5..5dadc099 100644 --- a/Examples/39dropdown.php +++ b/Examples/39dropdown.php @@ -61,6 +61,7 @@ function transpose($value) { $continentColumn = 'D'; $column = 'F'; +// Set data for dropdowns foreach(glob('./data/continents/*') as $key => $filename) { $continent = pathinfo($filename, PATHINFO_FILENAME); echo "Loading $continent", EOL; @@ -87,6 +88,8 @@ foreach(glob('./data/continents/*') as $key => $filename) { ++$column; } + +// Hide the dropdown data $objPHPExcel->getActiveSheet() ->getColumnDimension($continentColumn) ->setVisible(false); @@ -99,6 +102,7 @@ $objPHPExcel->addNamedRange( ); +// Set selection cells $objPHPExcel->getActiveSheet() ->setCellValue('A1', 'Continent:'); $objPHPExcel->getActiveSheet() @@ -111,6 +115,7 @@ $objPHPExcel->getActiveSheet() ->getStyle('A1:A3') ->getFont()->setBold(true); +// Set linked validators $objValidation = $objPHPExcel->getActiveSheet() ->getCell('B1') ->getDataValidation(); diff --git a/Examples/data/continents/Africa.txt b/Examples/data/continents/Africa.txt new file mode 100644 index 00000000..407fa769 --- /dev/null +++ b/Examples/data/continents/Africa.txt @@ -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 diff --git a/Examples/data/continents/Asia.txt b/Examples/data/continents/Asia.txt new file mode 100644 index 00000000..9ce006c5 --- /dev/null +++ b/Examples/data/continents/Asia.txt @@ -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 diff --git a/Examples/data/continents/Europe.txt b/Examples/data/continents/Europe.txt new file mode 100644 index 00000000..70c11607 --- /dev/null +++ b/Examples/data/continents/Europe.txt @@ -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 diff --git a/Examples/data/continents/North America.txt b/Examples/data/continents/North America.txt new file mode 100644 index 00000000..5881ae13 --- /dev/null +++ b/Examples/data/continents/North America.txt @@ -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 diff --git a/Examples/data/continents/Oceania.txt b/Examples/data/continents/Oceania.txt new file mode 100644 index 00000000..cbdc896c --- /dev/null +++ b/Examples/data/continents/Oceania.txt @@ -0,0 +1,14 @@ +Australia +Fiji +Kiribati +Marshall Islands +Micronesia +Nauru +New Zealand +Palau +Papua New Guinea +Samoa +Solomon Islands +Tonga +Tuvalu +Vanuatu diff --git a/Examples/data/continents/South America.txt b/Examples/data/continents/South America.txt new file mode 100644 index 00000000..777ffbfb --- /dev/null +++ b/Examples/data/continents/South America.txt @@ -0,0 +1,12 @@ +Argentina +Bolivia +Brazil +Chile +Colombia +Ecuador +Guyana +Paraguay +Peru +Suriname +Uruguay +Venezuela