Xml freeze pane and column width

Hi

I have generated an xml export using ruby on rails. There are two things
that I have not be able to do. The first is to freeze the header pane
(after a look around, I think that this may not be possible?) and the
second is to let the column width to be changed for columns as I define
(a line of code for each column, because they should all be different
widths).

Does anyone have experience with this? My difficulties come at around
line 45 of the following.

Many thanks

Darren

#This file is used to convert data from the database into an xml flow,
so that the data can be exported in an excel format: added by Darren
Evans, October 2006
xml.instruct! :xml, :version=>“1.0”, :encoding=>“UTF-8”
xml.Workbook({
‘xmlns’ => “urn:schemas-microsoft-com:office:spreadsheet”,
‘xmlns:o’ => “urn:schemas-microsoft-com:office:office”,
‘xmlns:x’ => “urn:schemas-microsoft-com:office:excel”,
‘xmlns:html’ => “http://www.w3.org/TR/REC-html40”,
‘xmlns:ss’ => “urn:schemas-microsoft-com:office:spreadsheet”

}) do

xml.Styles do
xml.Style ‘ss:ID’ => ‘Default’, ‘ss:Name’ => ‘Normal’ do
xml.Alignment ‘ss:Vertical’ => ‘Bottom’, ‘ss:Horizontal’ => ‘Left’
xml.Borders
xml.Font ‘ss:FontName’ => ‘Verdana’
xml.Interior
xml.NumberFormat
xml.Protection

end

xml.Style ‘ss:ID’ => ‘s22’ do
xml.NumberFormat ‘ss:Format’ => ‘General Date’
end

xml.Style ‘ss:ID’ => ‘s21’, ‘ss:Name’ => ‘Bold’ do
xml.Alignment ‘ss:Vertical’ => ‘Bottom’, ‘ss:Horizontal’ => ‘Left’
xml.Borders
xml.Font ‘ss:FontName’ => ‘Verdana’, ‘ss:Bold’ => ‘1’
xml.Interior
xml.NumberFormat
xml.Protection
end

end

xml.Worksheet ‘ss:Name’ => ‘Price List’ do
xml.Table ‘ss:DefaultColumnWidth’=> ‘200’ do

  # Header
  xml.Row 'ss:StyleID' => 's21' do
    for column in Product.content_columns do

       if (column.human_name!="Id") && 

(column.human_name!=“Identity”) && (column.human_name!=“Position”) &&
(column.human_name!=“Active”) && (column.human_name!=“Section”) &&
(column.human_name!=“Subsection”) &&
(column.human_name!=“Subsubsection”) && (column.human_name!=“Updated
at”) && (column.human_name!=“Updated by”)
xml.Cell do
xml.Data column.human_name, ‘ss:Type’ => ‘String’
end
end
end

    for column in @categories do
      xml.Cell do
        xml.Data column.name+" ("+session[:currency_name]+")", 

‘ss:Type’ => ‘String’
end
end
end
# Rows
for product in @export
xml.Row do
for column in Product.content_columns do
if (column.human_name!=“Id”) &&
(column.human_name!=“Identity”) && (column.human_name!=“Position”) &&
(column.human_name!=“Active”) && (column.human_name!=“Section”) &&
(column.human_name!=“Subsection”) &&
(column.human_name!=“Subsubsection”) && (column.human_name!=“Updated
at”) && (column.human_name!=“Updated by”)
xml.Cell do
if (column.human_name!=“Ata”) &&
(column.human_name!=“Minimum quantity”) && (column.human_name!=“Standard
lead time”)&& (column.human_name!=“Mtbf”) && (column.human_name!=“Repair
tat”) && (column.human_name!=“Overhaul tat”)
xml.Data product.send(column.name), ‘ss:Type’ => ‘String’
else
xml.Data product.send(column.name), ‘ss:Type’ => ‘Number’
end

          end
       end
      end
    @prices=Price.find(:all, :conditions => ["currencies_id = ? AND 

products_id = ?", session[:currency_id], product.id])
count=1
for price in @prices do
if ((price.categories_id==2) &&
(session[:currency_name]!=“CHF”))
xml.Cell do
xml.Data “-”, ‘ss:Type’ => ‘String’
end
end

        xml.Cell do
          if(price.value!="-")
            xml.Data price.value, 'ss:Type' => 'String'
          else
            xml.Data "-", 'ss:Type' => 'String'
          end
        end

        if ((price.categories_id==1) && 

(session[:currency_name]!=“CHF”))
3.times do
xml.Cell do
xml.Data “-”, ‘ss:Type’ => ‘String’
end
end
end
end
end
end
end
end
end

Hi

I have generated an xml export using ruby on rails. There are two things
that I have not be able to do. The first is to freeze the header pane
(after a look around, I think that this may not be possible?) and the
second is to let the column width to be changed for columns as I define
(a line of code for each column, because they should all be different
widths).

Does anyone have experience with this? My difficulties come at around
line 45 of the following.

Many thanks

Darren

#This file is used to convert data from the database into an xml flow,
so that the data can be exported in an excel format: added by Darren
Evans, October 2006
xml.instruct! :xml, :version=>“1.0”, :encoding=>“UTF-8”
xml.Workbook({
‘xmlns’ => “urn:schemas-microsoft-com:office:spreadsheet”,
‘xmlns:o’ => “urn:schemas-microsoft-com:office:office”,
‘xmlns:x’ => “urn:schemas-microsoft-com:office:excel”,
‘xmlns:ss’ => “urn:schemas-microsoft-com:office:spreadsheet”
}) do

xml.Styles do
xml.Style ‘ss:ID’ => ‘Default’, ‘ss:Name’ => ‘Normal’ do
xml.Alignment ‘ss:Vertical’ => ‘Bottom’, ‘ss:Horizontal’ => ‘Left’
xml.Borders
xml.Font ‘ss:FontName’ => ‘Verdana’
xml.Interior
xml.NumberFormat
xml.Protection
end

xml.Style ‘ss:ID’ => ‘s22’ do
xml.NumberFormat ‘ss:Format’ => ‘General Date’
end

xml.Style ‘ss:ID’ => ‘s21’, ‘ss:Name’ => ‘Bold’ do
xml.Alignment ‘ss:Vertical’ => ‘Bottom’, ‘ss:Horizontal’ => ‘Left’
xml.Borders
xml.Font ‘ss:FontName’ => ‘Verdana’, ‘ss:Bold’ => ‘1’
xml.Interior
xml.NumberFormat
xml.Protection
end
end

xml.Worksheet ‘ss:Name’ => ‘Vibro-Meter Price List’ do
xml.Table ‘ss:DefaultColumnWidth’=> ‘200’ do
# Header
xml.Row ‘ss:StyleID’ => ‘s21’ do
for column in Product.content_columns do

       if (column.human_name!="Id") && 

(column.human_name!=“Identity”) && (column.human_name!=“Position”) &&
(column.human_name!=“Active”) && (column.human_name!=“Section”) &&
(column.human_name!=“Subsection”) &&
(column.human_name!=“Subsubsection”) && (column.human_name!=“Updated
at”) && (column.human_name!=“Updated by”)
xml.Cell do
xml.Data column.human_name, ‘ss:Type’ => ‘String’
end
end
end

    for column in @categories do
      xml.Cell do
        xml.Data column.name+" ("+session[:currency_name]+")", 

‘ss:Type’ => ‘String’
end
end
end
# Rows
for product in @export
xml.Row do
for column in Product.content_columns do
if (column.human_name!=“Id”) &&
(column.human_name!=“Identity”) && (column.human_name!=“Position”) &&
(column.human_name!=“Active”) && (column.human_name!=“Section”) &&
(column.human_name!=“Subsection”) &&
(column.human_name!=“Subsubsection”) && (column.human_name!=“Updated
at”) && (column.human_name!=“Updated by”)
xml.Cell do
if (column.human_name!=“Ata”) &&
(column.human_name!=“Minimum quantity”) && (column.human_name!=“Standard
lead time”)&& (column.human_name!=“Mtbf”) && (column.human_name!=“Repair
tat”) && (column.human_name!=“Overhaul tat”)
xml.Data product.send(column.name), ‘ss:Type’ => ‘String’
else
xml.Data product.send(column.name), ‘ss:Type’ => ‘Number’
end

          end
       end
      end
    @prices=Price.find(:all, :conditions => ["currencies_id = ? AND 

products_id = ?", session[:currency_id], product.id])
count=1
for price in @prices do
if ((price.categories_id==2) &&
(session[:currency_name]!=“CHF”))
xml.Cell do
xml.Data “-”, ‘ss:Type’ => ‘String’
end
end

        xml.Cell do
          if(price.value!="-")
            xml.Data price.value, 'ss:Type' => 'String'
          else
            xml.Data "-", 'ss:Type' => 'String'
          end
        end

        if ((price.categories_id==1) && 

(session[:currency_name]!=“CHF”))
3.times do
xml.Cell do
xml.Data “-”, ‘ss:Type’ => ‘String’
end
end
end
end
end
end
end
end
end