1. Huubss
  2. RO CSVI
  3. Monday, 10 July 2023
  4.  Subscribe via email
I want my XLSX to be a bit styled by applying colors to specific custom fields that I export. How can I do that?
Accepted Answer Pending Moderation
Hello,
XLSX formatting options was included with RO CSVI 8.8.0 version. So if you have this version of RO CSVI you need to set Export type as XLSX on File tab in your export template. You can then see XLSX header format tab in template settings for column headers and also XLS Format tab for template fields. See attached screenshot.
Attachments (3)
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hello,
XLSX formatting options was included with RO CSVI 8.8.0 version. So if you have this version of RO CSVI you need to set Export type as XLSX on File tab in your export template. You can then see XLSX header format tab in template settings for column headers and also XLS Format tab for template fields. See attached screenshot.


Awesome! Is it possible to add things to a field conditionally?

For example I have made changes to my export installation in the past to add black lines between orders, and when the order item is from teh same order don't add black lines between them. Is it possible to for example add colors to the names of the order if the order id is the same?

And for example add a color to the "quantity" field if the value is > 1 ?
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,
We have added only basic formatting like background colour, alignment, font styles, font size and font colours. Conditional formatting is not possible as the feature is not added yet.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
Hello,
We have added only basic formatting like background colour, alignment, font styles, font size and font colours. Conditional formatting is not possible as the feature is not added yet.


Can you perhaps point me in the right direction to accomplish this in the helper of the export of the xlsx file?

I had this for the black lines:


public function prepareContent(array $contents): string
{
if ($contents)
{



if($this->lastOrderId != end($contents)){
$this->worksheet->getStyle('A'.$this->row.':O'.$this->row)->getBorders()->getTop()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK);

}

$this->worksheet->getRowDimension($this->row)->setRowHeight(40);

$this->worksheet->fromArray($contents, null, 'A' . $this->row);

$this->lastOrderId = end($contents);

$this->row++;


}

//Styling
foreach ($this->worksheet->getColumnIterator() as $column) {
$this->worksheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
// $this->worksheet->getStyle($column->getColumnIndex())->getAlignment()->setIndent(1);
}

return '';
}
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Hello,
With RO CSVI 8.8.0 version in XLSX helper file on line 230 we run a check on each template field for the formatting set on it. You need to implement your code after the field formatting (foreach loop from line 230 to 261) on line 261. Let me know if that helps.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!