Add quantity explosion to xlsx and csv

Closes #78
This commit is contained in:
Andy Meneely
2015-10-20 18:23:25 -04:00
parent dd1148d68f
commit 08381b86f0
12 changed files with 528 additions and 6 deletions
+9 -1
View File
@@ -15,4 +15,12 @@ Squib::Deck.new(cards: 2) do
end
# CSV is also a Squib-module-level function, so this also works:
data = Squib.csv file: 'sample.csv'
data = Squib.csv file: 'quantity_explosion.csv' # 2 rows...
num_cards = data['Name'].size # ...but 4 cards!
Squib::Deck.new(cards: num_cards) do
background color: :white
rect # card border
text str: data['Name'], font: 'Arial 54'
save_sheet prefix: 'sample_csv_qty_', columns: 4
end
+12
View File
@@ -14,6 +14,18 @@ Squib::Deck.new(cards: 3) do
save format: :png, prefix: 'sample_excel_' #save to individual pngs
end
# xlsx is also a Squib-module-level function, so this also works:
data = Squib.xlsx file: 'explode_quantities.xlsx' # 2 rows...
num_cards = data['Name'].size # ...but 4 cards!
Squib::Deck.new(cards: num_cards) do
background color: :white
rect # card border
text str: data['Name'], font: 'Arial 54'
save_sheet prefix: 'sample_xlsx_qty_', columns: 4
end
# Here's another example, a bit more realistic. Here's what's going on:
# * We call xlsx from Squib directly - BEFORE Squib::Deck creation. This
# allows us to infer the number of cards based on the size of the "Name"
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
Name,Qty
Basilisk,3
High Templar,1
1 Name Qty
2 Basilisk 3
3 High Templar 1