On Wed, Aug 8, 2012 at 2:05 PM, Iwan B. <[email protected]> wrote:
> This is the 'real' case (used for .xlsx files generation, via axlsx
> gem):
> p = Axlsx::Package.new
> wb = p.workbook
Well, you could do
class MyPackage < ::Axlsx::Package
class MyWorkbook < ::Axlsx::Workbook
def initialize(*a, &b)
super
# add styles
end
end
def workbook
MyWorkbook.new(self)
end
end
Or, if you just want to add default styles and values you could do
def ::Axlsx::Workbook.my_workbook
workbook.tap do |wb|
wb.styles.add_style sz: 16, b: true, alignment: { horizontal: :center }
...
end
end
> wb.styles.add_style sz: 16, b: true, alignment: { horizontal: :center }
> wb.add_worksheet(:name => "Basic Worksheet") do |sheet|
> ...
>
> I don't need the package object 'p', except for get a workbook.
It _may_ be stored inside the workbook.
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
-- You received this message because you are subscribed to the Google Groups
ruby-talk-google group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email
to [email protected]. For more options, visit this
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en