/**
  * generate data provider array (dataProviderList) based on income string
  * 
  * @param value String value
  * @throws DocumentException
  */
 protected function generateFromString($value)
 {
     if (DataUtils::valueIsMethod($value)) {
         $this->dataProvider = DataUtils::getValue($value);
         $this->generateTableData();
     } else {
         $bufMap = array();
         $bufMap["name1"] = $value;
         $data = array($bufMap);
         $this->generateFromArray($data);
     }
 }
예제 #2
0
 public function write()
 {
     parent::write();
     if ($this->value == null || strlen($this->value) == 0 || $this->fontSize == 0) {
         return;
     }
     $font = $this->getFont();
     $font->setFont($this->componentPdfWriter);
     $this->componentPdfWriter->SetXY($this->getPageX(), $this->getPageY());
     $val = DataUtils::getValue($this->value);
     if ($this->width == 0) {
         $this->width = $this->componentPdfWriter->GetStringWidth($val);
     }
     $this->componentPdfWriter->MultiCell($this->width + 6, $this->fontSize + 6, $val, 0, "L", false);
 }
예제 #3
0
 public function getColumnWidth(DataGridColumn $column)
 {
     $lenths = array();
     foreach ($this->dataProviderList as $data) {
         $lenths[] = strlen(DataUtils::getValue($data[$column->dataField])) * $this->fontSize;
     }
     return max($lenths);
 }
예제 #4
0
 public function buildOnMethod($value)
 {
     return Builder::buildDocument(DataUtils::getValue($value));
 }
예제 #5
0
 /**
  * Write one row of data into the table: {@link PdfPTable}
  * 
  * @param table {@link PdfPTable}
  * @param row array of string values to be placed
  * @param rowFontStyle font style for current row
  * @throws DocumentException 
  */
 private function writeRow($row)
 {
     $value = DataUtils::getValue($row);
     $this->componentPdfWriter->Cell($this->width, $this->rowHeight, $value, 0, 0, "L", true);
     $this->componentPdfWriter->Ln();
 }