thanks. this is the code which depends no my own nim files. The DLLs, I used on 
my windows 10 64bits, are:

  * [NPIO 2.5.5](https://www.nuget.org/packages/NPOI/2.5.5)
  * [sharpziplib 1.3.2.10](https://www.nuget.org/packages/SharpZipLib/1.3.2)
  * [BouncyCastle 1.8.2](https://www.nuget.org/packages/BouncyCastle/1.8.2)


    
    
    import sugar
    import winim/clr
    
    var
        mscor* = load("mscorlib")
        NPOIOOXML* = clr.load("NPOI.OOXML.dll")
    
    var
        File* = mscor.GetType("System.IO.File")
        WorkbookFactory* = 
NPOIOOXML.GetType("NPOI.SS.UserModel.WorkbookFactory")
    
    proc fn(fnExcel: string, strSheet: int|string=0): int =
        var stream= @File.OpenRead(fnExcel)
        var workbook = @WorkbookFactory.Create(stream);
        return workbook.NumberOfSheets
    
    var fnExcel = "testR.xlsx"
    
    dump fn(fnExcel, 0)
    #~ dump fn(fnExcel, "Sheet1")
    
    
    Run

Reply via email to