/**
	 * Get styles set for each field in template fields
	 *
	 * @param   object  $field  Field to process styles
	 *
	 * @return  array
	 *
	 * @since   8.8.0
	 */
	private function getFieldStyles(object $field): array
	{
		$horizontalAlignment = '';
		$verticalAlignment   = '';
		$bold                = false;
		$italic              = false;
		$sheetFont           = $this->template->get('sheet_font', 'Arial');
		if ($field->font_style)
		{
			switch ($field->font_style)
			{
				case 'bold':
					$bold = true;
					break;
				case 'italic':
					$italic = true;
					break;
				case 'bold italic':
					$bold   = true;
					$italic = true;
					break;
			}
		}
		if ($field->align_horizontal)
		{
			$horizontalAlignment = $this->getHorizontalAlignment($field->align_horizontal);
		}
		if ($field->align_vertical)
		{
			$verticalAlignment = $this->getVerticalAlignment($field->align_vertical);
		}
		$styleArray['font'] =
			[
				'name'   => $field->column_font ?? $sheetFont,
				'bold'   => $bold,
				'italic' => $italic,
				'size'   => $field->font_size ?: 12,
				'color'  => [
					'rgb' => $field->column_color ? substr($field->column_color, 1) : ''
				]
			];
		if ($horizontalAlignment && $verticalAlignment)
		{
			$styleArray['alignment'] =
				[
					$horizontalAlignment,
					$verticalAlignment,
				];
		}
		if ($field->column_background)
		{
			$styleArray['fill'] =
				[
					'fillType'   => Fill::FILL_SOLID,
					'startColor' => [
						'argb' => substr($field->column_background, 1),
					],
					'endColor'   => [
						'argb' => substr($field->column_background, 1),
					]
				];
		}
		if($field->column_header == "Aantal"){
			
			if((int)$field->cdata > 1){
				$styleArray['fill'] =
				[
					'fillType'   => Fill::FILL_SOLID,
					'startColor' => [
						'argb' => "fff81f",
					],
					'endColor'   => [
						'argb' => "fff81f",
					]
				];
			}
		}
		return $styleArray ?? [];
	}
			- Huubss
 - RO CSVI
 - Saturday, 05 August 2023
 - Subscribe via email
 
				I have XLSX export and i want the quanitity field to set to a color if the amount is higher than 1. I tried setting the helper export with this code, but it's not working.. Porbably because the field doesnt have a value?
			
			
			
			
							 
 			
			
			
			
		- Page :
 - 1
 
There are no replies made for this post yet.
Be one of the first to reply to this post!
			Be one of the first to reply to this post!