2013-09-22 55 views
1

任何人都可以找到代碼有什麼問題嗎?PHP與JavaBridge:POI設置自定義背景顏色

$workbook = new java("org.apache.poi.hssf.usermodel.HSSFWorkbook"); 
    $cellStyle = $workbook->createCellStyle(); 

    $palette = $this->workbook->getCustomPalette(); 
    $palette->setColorAtIndex(0x40, 0, 102, 204); 
    $backGroundColor = $palette->getColor(0x40); 

    $cellStyle->setFillForegroundColor($backGroundColor->getIndex()); 
    ... 
    $cell->setCellStyle($cellStyle); 

這段代碼不會改變背景顏色

反正

$cellStyle->setFillForegroundColor(0xc); // 0xc is index of blue 
    $cellStyle->setFillBackgroundColor(0xc); 

不起作用既不

回答