caxlsx / caxlsx_rails

A Rails plugin to provide templates for the axlsx gem
MIT License
744 stars 84 forks source link

Create frozen header row #176

Closed rctneil closed 6 months ago

rctneil commented 11 months ago

Hi,

My sheet looks like the below. How can I make the first row a frozen header row?

wb.add_worksheet(name: "People") do |sheet|
    sheet.add_row [
        "id",
        "name",
        "url"
    ]

    @people.each_with_index do |person, index|
        row = index + 1

        sheet.add_row [
            row, # id
            person.name, # name
            person.url # url
        ]
    end
end
straydogstudio commented 11 months ago

@rctneil Hi there. Note you're asking a question about Caxlsx and syntax. You'll get better results asking under the Caxlsx gem next time.

See if this example fits your needs: https://github.com/caxlsx/caxlsx/blob/a1b4439ebf77c094c7a75ead6b7e4262b9da951f/examples/panes_example.md