Devo cambiare il colore delle schede dei fogli Excel con un colore particolare ... qualcosa di simile usando lo scripting di ruby
risposte:
3 per risposta № 1Ecco un codice Ruby equivalente usando stdlib WIN32OLE
:
require "win32ole"
# create an instance of the Excel application object
excel = WIN32OLE.new("Excel.Application")
# make Excel visible
excel.visible = true
# open the excel from the desired path
wb = excel.workbooks.open("C:\Users\test.xlsx")
#iterate through each worksheet and color the tab as you want
1.upto(3).each do |i|
# getting the worksheet
wbs = wb.worksheets(i)
#color it
wbs.tab.color = 255
end
produzione
Guarda la documentazione di Tab.Color property
e Worksheet.Tab Property
.