function __construct($xls, $marker_block_width, $marker_block_height, $marker_offset_x, $marker_offset_y, $marker_size) { parent::__construct($xls); // args as disp scale(without marker window) $this->marker_block_width = $marker_block_width; $this->marker_block_height = $marker_block_height; $this->marker_offset_x = $marker_offset_x; $this->marker_offset_y = $marker_offset_y; $this->size_of_marker = $marker_size; // calc sheet size $this->sheet_width = 0; $this->sheet_height = 0; $width_marker_window_without_offset = $this->marker_block_width + $this->marker_offset_x; if ($this->marker_offset_x < 0) { // add offset $this->sheet_width += abs($this->marker_offset_x); $width_marker_window_without_offset = $this->marker_block_width; } if ($this->disp->tblwidth > $width_marker_window_without_offset) { $this->sheet_width += $this->disp->tblwidth; } else { $this->sheet_width += $width_marker_window_without_offset; } $height_marker_window_without_offset = $this->marker_block_height + $this->marker_offset_y; if ($this->marker_offset_y < 0) { // add offset $this->sheet_height += abs($this->marker_offset_y); $height_marker_window_without_offset = $this->marker_block_height; } if ($this->disp->tblheight > $height_marker_window_without_offset) { $this->sheet_height += $this->disp->tblheight; } else { $this->sheet_height += $height_marker_window_without_offset; } // 縮小/拡大率 $this->marker_scale = get_scaling($this->sheet_width, $this->sheet_height, 960); // 表示サイズ取得 $this->disp_sheet = new DispSheetMarker($this); }
function __construct($xls, $marker_window_web_ui) { $this->sheet = new Sheet($xls); $marker_size_on_sheet_scale = $marker_window_web_ui->marker_size / $marker_window_web_ui->scale; // create 3 marker objects $topLeftMarkerPositionX = $marker_window_web_ui->position_x + floor($marker_window_web_ui->marker_size / 2); $topLeftMarkerPositionY = $marker_window_web_ui->position_y + floor($marker_window_web_ui->marker_size / 2); $this->topLeftMarker = new MarkerOnSheet($marker_size_on_sheet_scale, $marker_size_on_sheet_scale, $this->sheet); $this->topLeftMarker->colNum = $this->sheet->disp->getCellNumX($topLeftMarkerPositionX); $this->topLeftMarker->rowNum = $this->sheet->disp->getCellNumY($topLeftMarkerPositionY); $topRightMarkerPositionX = $marker_window_web_ui->position_x + $marker_window_web_ui->width - floor($marker_window_web_ui->marker_size / 2); $topRightMarkerPositionY = $marker_window_web_ui->position_y + floor($marker_window_web_ui->marker_size / 2); $this->topRightMarker = new MarkerOnSheet($marker_size_on_sheet_scale, $marker_size_on_sheet_scale, $this->sheet); $this->topRightMarker->colNum = $this->sheet->disp->getCellNumX($topRightMarkerPositionX); $this->topRightMarker->rowNum = $this->sheet->disp->getCellNumY($topRightMarkerPositionY); $bottomLeftMarkerPositionX = $marker_window_web_ui->position_x + floor($marker_window_web_ui->marker_size / 2); $bottomLeftMarkerPositionY = $marker_window_web_ui->position_y + $marker_window_web_ui->height - floor($marker_window_web_ui->marker_size / 2); $this->bottomLeftMarker = new MarkerOnSheet($marker_size_on_sheet_scale, $marker_size_on_sheet_scale, $this->sheet); $this->bottomLeftMarker->colNum = $this->sheet->disp->getCellNumX($bottomLeftMarkerPositionX); $this->bottomLeftMarker->rowNum = $this->sheet->disp->getCellNumY($bottomLeftMarkerPositionY); // set or reset cell size with marker $this->cells_width = $this->sheet->cells_width; $this->cells_height = $this->sheet->cells_height; $this->set_cell_size_on_which_marker_is(); $this->cells_width = array_map("round2", $this->cells_width); $this->cells_height = array_map("round2", $this->cells_height); // set various sheet info with marker $this->tblwidth = $this->calc_tblwidth(); $this->tblheight = $this->calc_tblheight(); $this->col_count = $this->topRightMarker->colNum - $this->topLeftMarker->colNum - 1; $this->row_count = $this->bottomLeftMarker->rowNum - $this->topLeftMarker->rowNum - 1; $this->marker_scale = get_scaling($this->tblwidth, $this->tblheight, 940); $this->disp_sheet = new DispSheetCellFitMarker($this); }
function __construct($xls) { $this->xls = $xls; // サイズ取得 $this->tblwidth = 0; $this->tblheight = 0; $this->min_cell_width = 0; $this->min_cell_height = 0; for ($i = 0; $i <= $this->xls->maxcell[$this->sn]; $i++) { $this->cells_width[$i] = $this->xls->getColWidth($this->sn, $i); $this->tblwidth += $this->xls->getColWidth($this->sn, $i); if ($this->min_cell_width == 0 || $this->min_cell_width > $this->xls->getColWidth($this->sn, $i)) { $this->min_cell_width = $this->xls->getColWidth($this->sn, $i); } } for ($i = 0; $i <= $this->xls->maxrow[$this->sn]; $i++) { $this->cells_height[$i] = $this->xls->getRowHeight($this->sn, $i); $this->tblheight += $this->xls->getRowHeight($this->sn, $i); if ($this->min_cell_height == 0 || $this->min_cell_height > $this->xls->getRowHeight($this->sn, $i)) { $this->min_cell_height = $this->xls->getRowHeight($this->sn, $i); } } for ($col = 0; $col <= $this->xls->maxcell[$this->sn]; $col++) { for ($row = 0; $row <= $this->xls->maxrow[$this->sn]; $row++) { $colspan = $this->xls->celmergeinfo[$this->sn][$row][$col]['cspan']; if (isset($colspan) && $colspan > 1) { $this->cells_colrowspan['colspan'][$row][$col] = $colspan; } $rowspan = $this->xls->celmergeinfo[$this->sn][$row][$col]['rspan']; if (isset($rowspan) && $rowspan > 1) { $this->cells_colrowspan['rowspan'][$row][$col] = $rowspan; } } } $this->row_count = $this->xls->maxrow[$this->sn]; $this->col_count = $this->xls->maxcell[$this->sn]; $this->scale = get_scaling($this->tblwidth, $this->tblheight, 940); // 表示サイズ取得 $this->disp = new DispSheet($this); // A1 cell の大きさをマーカーサイズとする $this->marker_size = $this->disp->cells_width[0]; if ($this->disp->cells_height[0] > $this->disp->cells_width[0]) { $this->marker_size = $this->disp->cells_height[0]; } }