Skip to content

How does row style relates to rich text? #399

Description

@sineed

Hi! Thank you for awesome gem.

I have one question about usage of rich text. In my project I want to use superscript Excel text feature. Looking for this task led me to this issue #225. For now my implementation looks something like this:

def build_unit(base, exponent)
  unit = Axlsx::RichText.new
  unit.add_run(base)
  unit.add_run(exponent, vertAlign: :superscript)
  unit
end

Then I use this build method in add_row call:

worksheet.add_row(
  [list_number, label, build_unit("m", "3"), value]
  style: [style[:list_number], style[:label], style[:unit], style[:value]]
)

The problem is that style[:unit] doesn't apply to RichText object.

I doesn't know is this a correct behaviour or not, so I wrote two specs which show my assumptions of how this should work. You can see them in this PR #398.

I assume that I can use axlsx api improperly so maybe there is a better solution of assigning rich text run properties from row style.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions