0

I'm using Excel Application on Window Server to convert Excel to PDF. I want to know whether I can start Excel Application by Golang or Nodejs on Window Server. I see some examples of running Excel Application by Ruby, Python, C#. For example:

require 'win32ole'

class TestDemo < Test::Unit::TestCase
   def testExcelMacro
    # Arrange
    excel = WIN32OLE.new("Excel.Application")
    excel.Visible = true
    excel.Workbooks.Open('C:\temp\Test.xlsm')

    # Act
    excel.run "Sheet1!WriteToA1"

    # Assert
    worksheet = excel.Workbooks.ActiveWorkbook
    assert_equal("blah", worksheet.Range("A1").Value)

    excel.Quit  
   end
end
from win32com import client
xlApp = client.Dispatch("Excel.Application")
books = xlApp.Workbooks.Open('C:\\excel\\trial.xls')
ws = books.Worksheets[0]
ws.Visible = 1
ws.ExportAsFixedFormat(0, 'C:\\excel\\trial.pdf')
Tran B. V. Son
  • 599
  • 9
  • 27

1 Answers1

0

If talk about node.js you can use winax library or something similar for work with activex/com/dcom. But I believe you can use just build-in in windows javascript interpreter (not node.js) for it.

Yaroslav Gaponov
  • 1,793
  • 11
  • 11