I have a file named report.pdf.prawn, which is the view part of my PDF file where we can edit the contents of the PDF file like >>> pdf=Prawn::Document.new(:page_layout =>:landscape,:page_size => ''A4'') pdf.text"Hello" head=@headers headers=[""],[""] pdf.table headers, :width => 768, :size => 11, :border_style => :underline_header, :headers => [head.titleize], :header_color => ''b7e3fe'', :padding=>5 <<< etc ect... The above just prints like Hello Header1header2header3 I have two values from my controller >>> def report <<< as @header and @data @header gives values like>> Header1Header2Header3 @data gives values like>> data11data12data13data21data22data23 How do i print the values like the format given below on all PDF pages being generated? Header1 Header2 Header3 data11 data12 data13 data21 data22 data23 data31 data32 data33 data41 data42 data33 Please help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, Use the :column_widths=>{0=>100,1=>100, 2=>100, etc..} property. Jan On Aug 13, 9:27 am, Jeffrey Bonson <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have a file named report.pdf.prawn, > which is the view part of my PDF file where we can edit the contents of > the PDF file like >>> > pdf=Prawn::Document.new(:page_layout =>:landscape,:page_size => ''A4'') > pdf.text"Hello" > > head=@headers > headers=[""],[""] > pdf.table headers, > :width => 768, > :size => 11, > :border_style => :underline_header, > :headers => [head.titleize], > :header_color => ''b7e3fe'', > :padding=>5 > > <<< etc ect... > The above just prints like > > Hello > Header1header2header3 > > I have two values from my controller >>> def report <<< as > @header and @data > > @header gives values like>> Header1Header2Header3 > @data gives values like>> data11data12data13data21data22data23 > > How do i print the values like the format given below on all PDF pages > being generated? > > Header1 Header2 Header3 > > data11 data12 data13 > data21 data22 data23 > data31 data32 data33 > data41 data42 data33 > > Please help. > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I used the " :column_widths " property before, since the Header field comes in as hash values, te :column_widths of 0=>100 will be assigned to the first header only, the remaining cell widths will not be taken. What i was asking, is the format to be printed on PDF. thanks for replying. javinto wrote:> Hi, > > Use the :column_widths=>{0=>100,1=>100, 2=>100, etc..} property. > > Jan-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
headerbar=[] @data.each do |column| data=[] if @headers.include?(''dataXX'') column.number data << column.number end if @headers.include?(''dataXX'') column.number data << column.number end headerbar << data end pdf.table headerbar, :width => 768, :size => 11, :border_style => :underline_header, :headers => @header, :header_color => ''b7e3fe'', :column_widths=>{0=>55,1=>100,2=>70,3=>77,4=>88,5=>90,6=>75,7=>75,8=>75,9=>65,10=>55,11=>55}, :padding=>5 Not fully rectified, but works. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.