Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:41:57+00:00 2026-06-11T08:41:57+00:00

I am trying to generate a simple table in ruby with prawn pdf. I

  • 0

I am trying to generate a simple table in ruby with prawn pdf.

I need some text in a cell to be bold, and some to be not bold. For example:

Example table
Now following some examples, I have the basic table rendering with this code:

pdf.table([
  ["1. Row example text", "433"],
  ["2. Row example text", "2343"],
  ["3. Row example text", "342"],
  ["4. Row example text", "36"]], :width => 500, :cell_style => {
    :font_style => :bold})

But I can see absolutely no way of inserting more text into the first cell with a different format. (In this case I want it to be unbolded)

Does anyone know how to accomplish this?

Thanks for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:41:58+00:00Added an answer on June 11, 2026 at 8:41 am
    Prawn::Document.generate("test.pdf") do |pdf|
         table_data = [[Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>1. Row example text</b> \n\nExample Text Not Bolded", :inline_format => true), "433"],
                       [Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>2. Row example text</b>", :inline_format => true), "2343"],
                       [Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>3. Row example text</b>", :inline_format => true), "342"],                    
                       [Prawn::Table::Cell::Text.new( pdf, [0,0], :content => "<b>4. Row example text</b>", :inline_format => true), "36"]]
    
        pdf.table(table_data,:width => 500)
    end
    

    You can also do

    Prawn::Document.generate("test.pdf") do |pdf|
        table_data = [["<b>1. Row example text</b>\n\nExample Text Not Bolded", "<b>433<b>"], 
                      ["<b>2. Row example text</b>", "<b>2343</b>"], 
                      ["<i>3. Row example text</i>", "<i>342</i>"],
                      ["<b>4. Row example text</b>", "<sub>36</sub>"]]
    
        pdf.table(table_data, :width => 500, :cell_style => { :inline_format => true })
    end
    

    Prawn’s inline_format supports <b>, <i>, <u>, <strikethrough>, <sub>, <sup>, <font>, <color> and <link>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to Generate Fourier Spectrum of a simple image. But what I
I'm trying to figure out how to generate a simple join that uses an
I'm trying to set up a simple login using AuthLogic into my User table.
I am trying to write a class to serialize/deserialize something as simple as: <table
I'm trying to accomplish a fairly simple task for my website, but Im not
I've been struggling for a week now trying to figure out how to generate
Trying to setup a simple Thread/Poll table mapping. Here is what I have: Threads
I'm trying to generate some sql that is used to calculate some final scores
I need some help is MS SQL Server Query. I’m not much of a
I'm trying to put together a simple system for a user to generate a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.