Hello,
Considering that I am a Windows user (since my childhood... just kidding), and considering I was in great need of a way to work with Excel files, I am very happy to have discovered Winim.
Practically all my problems are over! Great work @khchen !!
However, I have a question: given the code below https://github.com/khchen/winim/blob/master/examples/com/Excel_Application2.nim
import strutils
import winim.com
comScript:
var obj = CreateObject("Excel.Application")
obj.visible = true
obj.workbooks.add()
var
s1 = "the quick fox jumps over the lazy brown dog".split(" ")
s2 = @[@[1, 2], @[3, 4, 5, 6, 7], @[8, 9, 10, 11], @[12], @[13, 14, 15]]
obj.activeSheet.range("A1:E6").clear()
obj.activeSheet.range("A1:I1") = s1 # this convert seq to 1D safearray
obj.activeSheet.range("A2:E6") = s2 # this convert seq to 2D safearray
COM_FullRelease()
How do I save the worksheet that was created in memory?
Congrats on finding that.
I'm not sure, but I get several results if I google for "Component Object Model Excel.Application"
Another way to put it - I think you'll have some success if you try to make a Windows app (eg: VB.net, VBscript, C#, etc, whatever you know best) that uses the "Excel.Application" COM API directly, and then see if that maps back well to the Nim library.
No experience here,
but if you google "excel vba saveas worksheet" and find some VBA code like
With ActiveWorkbook
.SaveAs "C:\" & .Sheets(1).Name
.Close 0
End With
then you should be able to do something like
obj.activeSheet.saveAs("insert the new name here :-)")
obj.activeSheet.close(0)