At the moment we can apply some styling for the table's header and this issue is supposed to provide a way to allow changing cells style using @FieldFormatter plugins that should be added to fields in Views configuration.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BR0kEN created an issue. See original summary.

br0ken’s picture

Status: Active » Needs review
StatusFileSize
new5.67 KB
br0ken’s picture

StatusFileSize
new7.15 KB
new3.63 KB
br0ken’s picture

Issue tags: +DevDaysTransylvania
l0ke’s picture

Status: Needs review » Needs work

We had a long discussion regarding the approach and agreed on the next things:

  1. Keep the idea of having Formatter responsible for the styling. It looks much more flexible then pass the value in a specific format and then process it in Encoder.
  2. Try to avoid this strpos and unserialize
    +++ b/src/Encoder/Xls.php
    @@ -253,13 +255,26 @@ class Xls implements EncoderInterface {
    +        if (strpos($value, ViewsExcelStyledFieldItemValue::class . '":') !== FALSE) {
    +          $styled = unserialize($value, [ViewsExcelStyledFieldItemValue::class]);
    
  3. To achieve 2. one of the options is to write a RowPlugin that will skip serialization for fields with formatter ViewsExcelStyledFieldCellFormatterInterface so it can be processed in Ecoder.
br0ken’s picture

Status: Needs work » Needs review

After hours of debugging I gave up because everything in Views infrastructure tries to cast a string type to the data and that seems logical since we're going to render things. Even if we manage to return an object after applying display, style, row and field Views plugins the the serializer service will not be able to normalize the object we've preserved.

This is not a trivial scenario because we need to jump back from an encoder to a field formatter. Right now I don't see an acceptable way to implement this solution without having ugly strpos + unserialize.

l0ke’s picture

Status: Needs review » Reviewed & tested by the community

Considering the proposed solution works and except for the hack with strpos and unserialize looks good to me marking as RTBC.
In the end, good enough is enough.

br0ken’s picture

Issue tags: +DevDaysCluj
rosinegrean’s picture

Issue tags: -DevDaysCluj
br0ken’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new8.53 KB
new6.05 KB

This patch provides full flexibility in manipulating by a worksheet, cell, and its value. See attached documentation.

bahbka’s picture

StatusFileSize
new8.44 KB

Adjusted #10 to be applied to the latest stable version.

theemstra’s picture

Status: Needs review » Needs work

Cleaning old issues from previous releases.
We can include it, when someone provides a MR or patch that can be applied to current codebase, we'll test and merge!

mably made their first commit to this issue’s fork.

mably’s picture

Version: 8.x-1.x-dev » 2.1.x-dev
Assigned: br0ken » Unassigned
Status: Needs work » Needs review

Implemented some basic Excel formatters (string, datetime, timestamp) that add new configuration options allowing to collapse/hide columns, define horizontal alignment, set font bold or italic.

Any feedback will be greatly appreciated.

mably’s picture

Just added an ExcelImageFormatter allowing to insert images into your exported Excel files:

Handle images

mably’s picture

This can now be tested in the new Excel Serialization Extras sandbox module.

mably changed the visibility of the branch 3060027-allow-styling-table to hidden.