Advertisement
Guest User

DRYAD Generator Ruby

a guest
Jul 19th, 2015
345
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None
  1. require 'axlsx'
  2.  
  3. #Axlsx boilerplate
  4. p = Axlsx::Package.new
  5. wb = p.workbook
  6.  
  7. #Generate a random 5 letter code word
  8. def rand
  9. [*('A'..'Z')].sample(5).join
  10. end
  11.  
  12. #Axlsx style enhancements
  13.  
  14.  
  15.  
  16. wb.add_worksheet(:name => "Dryad Worksheet" ) do |sheet|
  17.  
  18.  
  19.  
  20. sheet.add_row(['For Training Use Only', '', "UID:", ""])
  21. sheet.add_row(["Start DTG:", "", "End DTG:", ""])
  22. sheet.add_row(["Distribution", "", ""])
  23. sheet.add_row([""])
  24.  
  25. sheet.add_row ['', 'ABCD', 'EFG', 'HIJ', 'KL', 'MN', 'OPQ', 'RS', 'TUV', 'WX', 'YZ',]
  26. sheet.add_row ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',]
  27.  
  28. sheet.add_row ['A', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  29. sheet.add_row ['B', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  30. sheet.add_row ['C', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  31. sheet.add_row ['D', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  32. sheet.add_row ['E', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  33. sheet.add_row ['F', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  34.  
  35.  
  36. sheet.add_row ['','', '', '', '', '', '', '', '', '', ]
  37. sheet.add_row ['', 'ABCD', 'EFG', 'HIJ', 'KL', 'MN', 'OPQ', 'RS', 'TUV', 'WX', 'YZ',]
  38. sheet.add_row ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',]
  39.  
  40.  
  41. sheet.add_row ['G', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  42. sheet.add_row ['H', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  43. sheet.add_row ['I', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  44. sheet.add_row ['J', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  45. sheet.add_row ['K', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  46. sheet.add_row ['L', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  47.  
  48.  
  49. sheet.add_row ['','', '', '', '', '', '', '', '', '', ]
  50. sheet.add_row ['', 'ABCD', 'EFG', 'HIJ', 'KL', 'MN', 'OPQ', 'RS', 'TUV', 'WX', 'YZ',]
  51. sheet.add_row ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',]
  52.  
  53.  
  54. sheet.add_row ['M', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  55. sheet.add_row ['N', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  56. sheet.add_row ['O', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  57. sheet.add_row ['P', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  58. sheet.add_row ['Q', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  59. sheet.add_row ['R', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  60.  
  61.  
  62. sheet.add_row ['','', '', '', '', '', '', '', '', '', ]
  63. sheet.add_row ['', 'ABCD', 'EFG', 'HIJ', 'KL', 'MN', 'OPQ', 'RS', 'TUV', 'WX', 'YZ',]
  64. sheet.add_row ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',]
  65.  
  66.  
  67. sheet.add_row ['S', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  68. sheet.add_row ['T', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  69. sheet.add_row ['U', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  70. sheet.add_row ['V', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  71. sheet.add_row ['W', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  72. sheet.add_row ['X', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  73. sheet.add_row ['Y', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  74. sheet.add_row ['Z', rand, rand, rand, rand, rand, rand, rand, rand, rand, rand,]
  75.  
  76.  
  77.  
  78.  
  79. end
  80.  
  81. p.serialize('DryadGenerator.xlsx')
Advertisement
RAW Paste Data Copied
Advertisement