適当に哲学書とやらを読んでみる

天の孔雀的、英語の本かなり意訳読み

全体表示

[ リスト ]

RubyでPDF出力-その4

ソースその2です。

その1はこちら。  

053:
  ##############################
054:
  #合計金額
055:
  ##############################
056:
  move_down 10
057:
  font_size = 12
058:
  text "下記の通りご請求申し上げますよろしくお願い致します"
059:
  move_down 2
060:
  #表形式のデータは配列で指定する
061:
  table(
062:
    [
063:
      ["ご請求金額", '\1,200-']
064:
    ],
065:
  #各カラムの幅をハッシュで指定する
066:
    :column_width => {0 => bounds.width * 0.4, 1 => bounds.width * 0.6},
067:
  #各カラムの横寄せをハッシュで指定する
068:
    :align => {0 => :left, 1 => :right},
069:
  #指定しないと幅がおかしくなる
070:
    :width => bounds.width                      
071:
  )
072:
 
073:
  ##############################
074:
  #内訳
075:
  ##############################
076:
  move_down 10
077:
  text "内訳"
078:
  table(
079:
    [
080:
      ["マタタビ", "3", '\100', '\300'],
081:
      ["猫砂", "1", '\900', '\900']
082:
    ],
083:
  #すべての行と列に線を引く
084:
    :border_style => :grid,
085:
  #一括してフォントサイズ指定
086:
    :font_size => 10,                           
087:
  #ヘッダーを指定
088:
    :headers => ["内容", "数量", "単価", "金額"],
089:
  #各カラムの幅を指定
090:
    :column_width => {
091:
      0 => bounds.width * 0.6,
092:
      1 => bounds.width * 0.1,
093:
      2 => bounds.width * 0.15,
094:
      3 => bounds.width * 0.15
095:
    },
096:
  #ヘッダーの横寄せをハッシュで指定
097:
    :align_headers => {                         
098:
      0 => :center,
099:
      1 => :center,
100:
      2 => :center,
101:
      3 => :center
102:
    },
103:
  #コンテンツの横寄せをハッシュで指定
104:
    :align => {                                 
105:
      0 => :left,
106:
      1 => :right,
107:
      2 => :right,
108:
      3 => :right
109:
    },
110:
    :width => bounds.width
111:
  )
112:
end

よしもとブログランキング

もっと見る

プライバシー -  利用規約 -  メディアステートメント -  ガイドライン -  順守事項 -  ご意見・ご要望 -  ヘルプ・お問い合わせ

Copyright (C) 2019 Yahoo Japan Corporation. All Rights Reserved.

みんなの更新記事