1

I'm trying to use IronScheme with the Open XML SDK to read an XLSX file.

The Open XML SDK API contains a method, which in C# is written as worksheetPart.Worksheet.Elements<SheetData>(), where passing the type parameter is helpful to filter the elements of the given type.

How would I translate that to IronScheme so that I can pass the SheetData type parameter? I tried the following calls, but they all returned all elements:

(clr-call Worksheet Elements sheet)             ; sure, will return all
(clr-call Worksheet (Elements Object) sheet)    ; syntax test -> allowed, but returns all
(clr-call Worksheet (Elements SheetData) sheet) ; sadly this also returns all

Thanks in advance, Frank

Frank Ruben
  • 105
  • 7

1 Answers1

0

You are using 'type hint' syntax (which is really a bug as it should be reported as not found).

The generic syntax is:

(clr-call Worksheet (Elements #(SheetData)) sheet)

You pass generic type parameters in as a vector for methods.

Sadly this is different from specifying generic type parameters for types.

I will put it on a TODO list.

leppie
  • 115,091
  • 17
  • 196
  • 297
  • Thanks leppie - and btw thanks a lot for IronScheme! The syntax proposed didn't work for me (using the latest pre-compiled release from [https://ironscheme.codeplex.com/releases/view/103028](CodePlex). – Frank Ruben Mar 09 '16 at 20:51
  • I tested by displaying the worksheet elements w/o type `(clr-call Worksheet Elements sheet)` and with the syntax stated above - same results and both result lists did contain elements of type different from `SheetData`. If it's a potential release problem I can compile from Github on my own, otherwise I can provide more details how to reproduce - but this would also need an Open XML install. – Frank Ruben Mar 09 '16 at 21:02
  • @FrankRuben: You can get latest builds here: https://ci.appveyor.com/project/leppie/ironscheme/branch/master (go to FX2 build, then artefacts), but it should not make a difference. I will try repro the generics issue, could be related to inheritance in the OpenXML API. – leppie Mar 10 '16 at 05:44
  • Hi leppie, thanks for your ongoing support. As you assumed, updating to the current build (1.0.99-54e877f) did not change the results. – Frank Ruben Mar 20 '16 at 15:59
  • 1
    I already have a workaround by filtering the unwanted instances using `filter`, so I'm fine. Regards, Frank – Frank Ruben Mar 20 '16 at 16:05