Support table and table column sizing
All checks were successful
CI Pipeline / build (pull_request) Successful in 13s
All checks were successful
CI Pipeline / build (pull_request) Successful in 13s
This commit is contained in:
@@ -343,6 +343,48 @@ Notare::Document.create(OUTPUT_FILE) do |doc|
|
||||
end
|
||||
end
|
||||
|
||||
doc.h3 "Table Column Sizing"
|
||||
|
||||
doc.p "Auto-layout table (columns fit content):"
|
||||
doc.table(layout: :auto) do
|
||||
doc.tr do
|
||||
doc.td "Short"
|
||||
doc.td "This column has much longer content that will expand"
|
||||
end
|
||||
end
|
||||
|
||||
doc.p "Fixed column widths in inches:"
|
||||
doc.table(columns: %w[2in 3in 1.5in]) do
|
||||
doc.tr do
|
||||
doc.td { doc.b { doc.text "2 inches" } }
|
||||
doc.td { doc.b { doc.text "3 inches" } }
|
||||
doc.td { doc.b { doc.text "1.5 inches" } }
|
||||
end
|
||||
doc.tr do
|
||||
doc.td "Column A"
|
||||
doc.td "Column B"
|
||||
doc.td "Column C"
|
||||
end
|
||||
end
|
||||
|
||||
doc.p "Percentage-based columns:"
|
||||
doc.table(columns: %w[25% 50% 25%]) do
|
||||
doc.tr do
|
||||
doc.td "25%"
|
||||
doc.td "50%"
|
||||
doc.td "25%"
|
||||
end
|
||||
end
|
||||
|
||||
doc.p "Per-cell width control:"
|
||||
doc.table do
|
||||
doc.tr do
|
||||
doc.td("Narrow", width: "1in")
|
||||
doc.td("Wide column", width: "4in")
|
||||
doc.td("Medium", width: "2in")
|
||||
end
|
||||
end
|
||||
|
||||
# ============================================================================
|
||||
# 10. Images
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user