0
更改Excel工作表的標籤顏色我需要改變Excel工作表的標籤顏色與特定的顏色......像這樣使用Ruby腳本使用Ruby
更改Excel工作表的標籤顏色我需要改變Excel工作表的標籤顏色與特定的顏色......像這樣使用Ruby腳本使用Ruby
下面是使用STDLIB WIN32OLE
等效的Ruby代碼:
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
輸出