0

I am using JXL.jar to generate Excel from ruby, when I format the cell, I need set the cell format with code like this: in java:

WritableFont font = new WritableFont(WritableFont.ARIAL, 20, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.RED);

in ruby with Rjb:

font_class = Rjb.import("jxl.write.WritableFont")
font       = font_class.new(WritableFont.ARIAL, 20,
                WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
                Colour.RED) 

this sure will not work, as ruby does not know WritableFont.ARIAL, so please help to point out how to send WritableFont.ARIAL like constant params to the font_class

Thanks in advance

philant
  • 34,748
  • 11
  • 69
  • 112
yundong
  • 1
  • 1

1 Answers1

1

I think you could use:

font_class = Rjb.import("jxl.write.WritableFont")
color_class = Rjb.import("...Color")  // Use the right color class
font = font_class.new(font_class.ARIAL, 20,
                font_class.BOLD, false, font_class.NO_UNDERLINE,
                color_class.RED) 
Vicente Quintans
  • 1,396
  • 12
  • 21