row_colors cannot be overrided #401

Closed
4nkh opened this Issue Sep 7, 2012 · 4 comments

Comments

Projects
None yet
2 participants

4nkh commented Sep 7, 2012

I want to override the table row_colors with the cell background_color option.

here's how I tried:

table my_rows do
row(0).font_style = :bold
columns(1..2).align = :left
columns(3..5).align = :right
self.row_colors = ["DDDDDD", "FFFFFF"]
self.header = true
self.cell_style = {size: 12}
end

def last_row
[@empty, @empty, @empty, {content: name, borders: [], background_color: "FFFFFF"}, "blah"]
end

It was possible with oldest prawn version, can someone point me on the right direction?

thank you

Member

bradediger commented Sep 7, 2012

This seems to be working fine for me on Prawn master:

Prawn::Document.generate 'test.pdf' do

  table([["foo"], ["bar"], ["baz"], [{content: "baz", background_color: "FF0000"}]]) do
    row(0).font_style = :bold
    columns(1..2).align = :left
    columns(3..5).align = :right
    self.row_colors = ["DDDDDD", "FFFFFF"]
    self.header = true
    self.cell_style = {size: 12}
  end

end

Generates a 4-row table where the first three rows are striped gray/white, and the last row (overridden background color) has a red background.

bradediger closed this Sep 7, 2012

4nkh commented Sep 8, 2012

I still have this issue with the 0.12.0 version

class ExamplePdf < Prawn::Document
    def initialize
        super(top_margin: 20)
        my_table
    end

    def my_table
        table([["foo"], ["bar"], ["baz"], [{content: "baz", background_color: "FF0000"}]]) do
            row(0).font_style = :bold
            columns(1..2).align = :left
            columns(3..5).align = :right
            self.row_colors = ["DDDDDD", "FFFFFF"]
            self.header = true
            self.cell_style = {size: 12}
        end
    end
end
Member

bradediger commented Sep 8, 2012

Can you try the master version from git? There have been a lot of changes
since 0.12.0.

On Sat, Sep 8, 2012 at 8:48 AM, M Bougie notifications@github.com wrote:

I still have this issue with the 0.12.0 version

class ExamplePdf < Prawn::Document
def initialize
super(top_margin: 20
my_table
end

def my_table
table([["foo"], ["bar"], ["baz"], [{content: "baz", background_color:
"FF0000"}]]) do
row(0).font_style = :bold
columns(1..2).align = :left
columns(3..5).align = :right
self.row_colors = ["DDDDDD", "FFFFFF"]
self.header = true
self.cell_style = {size: 12}
end
end


Reply to this email directly or view it on GitHubhttps://github.com/prawnpdf/prawn/issues/401#issuecomment-8387744.

4nkh commented Sep 8, 2012

ok i just tried the stable branch and it work, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment