Minor tweak to fix colours from the pallette index

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@86741 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-02-21 17:28:37 +00:00
parent 9b462e941d
commit 3392f46985
5 changed files with 62 additions and 62 deletions

View File

@ -419,7 +419,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
$xmlThemeName = $xmlTheme->attributes(); $xmlThemeName = $xmlTheme->attributes();
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
$themeName = (string)$xmlThemeName['name']; $themeName = (string)$xmlThemeName['name'];
$colourScheme = $xmlTheme->themeElements->clrScheme->attributes(); $colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
$colourSchemeName = (string)$colourScheme['name']; $colourSchemeName = (string)$colourScheme['name'];
$colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); $colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
@ -1644,7 +1644,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} else if (isset($color["indexed"])) { } else if (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"],$background)->getARGB(); return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
} else if (isset($color["theme"])) { } else if (isset($color["theme"])) {
if (self::$_theme !== NULL) { if (self::$_theme !== NULL) {
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]); $returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);

View File

@ -51,11 +51,11 @@ class PHPExcel_Reader_Excel2007_Chart
} // function _getAttribute() } // function _getAttribute()
private static function _readColor($color) { private static function _readColor($color,$background=false) {
if (isset($color["rgb"])) { if (isset($color["rgb"])) {
return (string)$color["rgb"]; return (string)$color["rgb"];
} else if (isset($color["indexed"])) { } else if (isset($color["indexed"])) {
return PHPExcel_Style_Color::indexedColor($color["indexed"])->getARGB(); return PHPExcel_Style_Color::indexedColor($color["indexed"]-7,$background)->getARGB();
} }
} }

View File

@ -369,62 +369,62 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
// Indexed colors // Indexed colors
if (is_null(self::$_indexedColors)) { if (is_null(self::$_indexedColors)) {
self::$_indexedColors = array( self::$_indexedColors = array(
1 => '00000000', // System Colour #1 - Black 1 => 'FF000000', // System Colour #1 - Black
2 => '00FFFFFF', // System Colour #2 - White 2 => 'FFFFFFFF', // System Colour #2 - White
3 => '00FF0000', // System Colour #3 - Red 3 => 'FFFF0000', // System Colour #3 - Red
4 => '0000FF00', // System Colour #4 - Green 4 => 'FF00FF00', // System Colour #4 - Green
5 => '000000FF', // System Colour #5 - Blue 5 => 'FF0000FF', // System Colour #5 - Blue
6 => '00FFFF00', // System Colour #6 - Yellow 6 => 'FFFFFF00', // System Colour #6 - Yellow
7 => '00FF00FF', // System Colour #7- Magenta 7 => 'FFFF00FF', // System Colour #7- Magenta
8 => '0000FFFF', // System Colour #8- Cyan 8 => 'FF00FFFF', // System Colour #8- Cyan
9 => '00800000', // Standard Colour #9 9 => 'FF800000', // Standard Colour #9
10 => '00008000', // Standard Colour #10 10 => 'FF008000', // Standard Colour #10
11 => '00000080', // Standard Colour #11 11 => 'FF000080', // Standard Colour #11
12 => '00808000', // Standard Colour #12 12 => 'FF808000', // Standard Colour #12
13 => '00800080', // Standard Colour #13 13 => 'FF800080', // Standard Colour #13
14 => '00008080', // Standard Colour #14 14 => 'FF008080', // Standard Colour #14
15 => '00C0C0C0', // Standard Colour #15 15 => 'FFC0C0C0', // Standard Colour #15
16 => '00808080', // Standard Colour #16 16 => 'FF808080', // Standard Colour #16
17 => '009999FF', // Chart Fill Colour #17 17 => 'FF9999FF', // Chart Fill Colour #17
18 => '00993366', // Chart Fill Colour #18 18 => 'FF993366', // Chart Fill Colour #18
19 => '00FFFFCC', // Chart Fill Colour #19 19 => 'FFFFFFCC', // Chart Fill Colour #19
20 => '00CCFFFF', // Chart Fill Colour #20 20 => 'FFCCFFFF', // Chart Fill Colour #20
21 => '00660066', // Chart Fill Colour #21 21 => 'FF660066', // Chart Fill Colour #21
22 => '00FF8080', // Chart Fill Colour #22 22 => 'FFFF8080', // Chart Fill Colour #22
23 => '000066CC', // Chart Fill Colour #23 23 => 'FF0066CC', // Chart Fill Colour #23
24 => '00CCCCFF', // Chart Fill Colour #24 24 => 'FFCCCCFF', // Chart Fill Colour #24
25 => '00000080', // Chart Line Colour #25 25 => 'FF000080', // Chart Line Colour #25
26 => '00FF00FF', // Chart Line Colour #26 26 => 'FFFF00FF', // Chart Line Colour #26
27 => '00FFFF00', // Chart Line Colour #27 27 => 'FFFFFF00', // Chart Line Colour #27
28 => '0000FFFF', // Chart Line Colour #28 28 => 'FF00FFFF', // Chart Line Colour #28
29 => '00800080', // Chart Line Colour #29 29 => 'FF800080', // Chart Line Colour #29
30 => '00800000', // Chart Line Colour #30 30 => 'FF800000', // Chart Line Colour #30
31 => '00008080', // Chart Line Colour #31 31 => 'FF008080', // Chart Line Colour #31
32 => '000000FF', // Chart Line Colour #32 32 => 'FF0000FF', // Chart Line Colour #32
33 => '0000CCFF', // Standard Colour #33 33 => 'FF00CCFF', // Standard Colour #33
34 => '00CCFFFF', // Standard Colour #34 34 => 'FFCCFFFF', // Standard Colour #34
35 => '00CCFFCC', // Standard Colour #35 35 => 'FFCCFFCC', // Standard Colour #35
36 => '00FFFF99', // Standard Colour #36 36 => 'FFFFFF99', // Standard Colour #36
37 => '0099CCFF', // Standard Colour #37 37 => 'FF99CCFF', // Standard Colour #37
38 => '00FF99CC', // Standard Colour #38 38 => 'FFFF99CC', // Standard Colour #38
39 => '00CC99FF', // Standard Colour #39 39 => 'FFCC99FF', // Standard Colour #39
40 => '00FFCC99', // Standard Colour #40 40 => 'FFFFCC99', // Standard Colour #40
41 => '003366FF', // Standard Colour #41 41 => 'FF3366FF', // Standard Colour #41
42 => '0033CCCC', // Standard Colour #42 42 => 'FF33CCCC', // Standard Colour #42
43 => '0099CC00', // Standard Colour #43 43 => 'FF99CC00', // Standard Colour #43
44 => '00FFCC00', // Standard Colour #44 44 => 'FFFFCC00', // Standard Colour #44
45 => '00FF9900', // Standard Colour #45 45 => 'FFFF9900', // Standard Colour #45
46 => '00FF6600', // Standard Colour #46 46 => 'FFFF6600', // Standard Colour #46
47 => '00666699', // Standard Colour #47 47 => 'FF666699', // Standard Colour #47
48 => '00969696', // Standard Colour #48 48 => 'FF969696', // Standard Colour #48
49 => '00003366', // Standard Colour #49 49 => 'FF003366', // Standard Colour #49
50 => '00339966', // Standard Colour #50 50 => 'FF339966', // Standard Colour #50
51 => '00003300', // Standard Colour #51 51 => 'FF003300', // Standard Colour #51
52 => '00333300', // Standard Colour #52 52 => 'FF333300', // Standard Colour #52
53 => '00993300', // Standard Colour #53 53 => 'FF993300', // Standard Colour #53
54 => '00993366', // Standard Colour #54 54 => 'FF993366', // Standard Colour #54
55 => '00333399', // Standard Colour #55 55 => 'FF333399', // Standard Colour #55
56 => '00333333' // Standard Colour #56 56 => 'FF333333' // Standard Colour #56
); );
} }

View File

@ -305,7 +305,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('customHeight', 'true'); $objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else { } else {
$objWriter->writeAttribute('defaultRowHeight', '12.75'); $objWriter->writeAttribute('defaultRowHeight', '14.4');
} }
// Default column width // Default column width

View File

@ -1685,7 +1685,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// The default column width is 8.43 // The default column width is 8.43
// The following slope and intersection values were interpolated. // The following slope and intersection values were interpolated.
// //
$y = 20*$y + 255; $y = 20*$y + 255;
$x = 113.879*$x + 390; $x = 113.879*$x + 390;
} }