# PDF::Writer and table columns

**URL:** <https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691>\
**Category:** Ruby\
**Created:** [January 18, 2006, 12:57am UTC](https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691 "2006-01-18T00:57:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [January 18, 2006, 12:57am UTC](https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691/1 "2006-01-18T00:57:24Z")

</div>

I’ve just started using the PDF::Writer and am having some trouble with  
table columns. When the PDF renders the columns of the table are not  
ordered by the column\_order. With my test data I have three tables with  
each table having a different column order and the last one being  
correct.  
The order of te first two columns on every table is consistent.

Here’s a sample of the code:

table.column\_order = %w(t field old new changed)

table.columns[“t”] = PDF::SimpleTable::Column.new(“t”) {|col|  
heading = PDF::SimpleTable::Column::Heading.new  
heading.title = “T”  
col.heading = heading  
}  
#repeat this for each of the columns

#to load the data  
data = []  
rows.each{ |row|  
data \<\< {“t” =\> row.change\_type,  
“field” =\> row.field\_name,  
“old” =\> row.old\_value,  
“new” =\> row.new\_value,  
“changed” =\> row.changed\_at}  
}

I hope it’s a case of “been staring at this for too long”.

thanks,  
andy

---

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [January 18, 2006, 3:40am UTC](https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691/2 "2006-01-18T03:40:23Z")

</div>

On 17/01/06, Andrew S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve just started using the PDF::Writer and am having some trouble with  
> table columns. When the PDF renders the columns of the table are not  
> ordered by the column\_order. With my test data I have three tables with  
> each table having a different column order and the last one being correct.  
> The order of te first two columns on every table is consistent.

I’m not seeing anything wrong with your sample code. Can you provide  
me a more complete sample with sample data? If this is business  
related, you can email it to me directly. It may also be worth seeing  
the output you’re getting.

-austin

---

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [January 18, 2006, 3:25pm UTC](https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691/3 "2006-01-18T15:25:51Z")

</div>

Thank you Austin.

-andy

---

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [January 18, 2006, 7:05am UTC](https://www.ruby-forum.com/t/pdf-writer-and-table-columns/52691/4 "2006-01-18T07:05:13Z")

</div>

On 17/01/06, Austin Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 17/01/06, Andrew S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’ve just started using the PDF::Writer and am having some trouble with  
> > table columns. When the PDF renders the columns of the table are not  
> > ordered by the column\_order. With my test data I have three tables with  
> > each table having a different column order and the last one being correct.  
> > The order of te first two columns on every table is consistent.

I have reopened bug item #2129, which describes the necessary patch. I  
will hopefully be able to provide a patched version soon; I am trying  
to track down a number of issues introduced in several adopted  
patches.

-austin
