F # 프로그램의 일부 입력을 정의하는 문서 리포지토리에 사용자 편집 가능한 Excel 파일이 있습니다. 나는 F # -y를 사용하여 그것을 읽고 싶습니다, 그래서 나는 FSharpX와 ExcelFile 타입 제공자를 시험해 볼 것이라고 생각했습니다.F # 형식 공급자 FSharpX.ExcelFile 및 다른 입력으로 작성하려고하는 이상한 형식 오류
공급자는 NuGet을 통해 설치 및 사용할 수 있습니다작동 무엇
,이 작품 :
open FSharpX
type Example = ExcelFile<"example.xlsx", "Worksheet1", true>
let file = new Example()
for row in File.Data do ......
내가 다른과 생성자를 초기화 할 때, 그러나하지
않습니다 파일 (하나는 런타임에 데이터베이스에서 꺼내어 임시 위치에 숨김)을 사용하면 정말 이상한 형식 오류가 발생합니다.
The type provider 'FSharpx.TypeProviders.ExcelProvider+ExcelProvider' reported an error in the context of provided type 'FSharpx.ExcelFile,filename="example.xlsx",sheetname="Worksheet1",forcestring="True"', member '.ctor'. The error: Type mismatch when splicing expression into quotation literal. The type of the expression tree being inserted doesn't match the type expected by the splicing operation. Expected 'System.String', but received type 'System.Tuple`2[System.String,System.String]'. Consider type-annotating with the expected expression type, e.g., (%% x : string) or (%x : string). Parameter name: receivedType
허에서
let file = new Example(@"c:\temp\path\to.xlsx")
결과?
터플이 어디서오고 있는지에 대해서는 잘 모릅니다. 초기화 방법에 대한 아이디어는 없습니다.
보너스 질문 : 런타임시 워크 시트 이름을 바꿀 경우 어떻게해야합니까? 기존 FSharpx 공급자는이를 허용하지 않습니다.
확인을, 그냥 확인 내가 미친 또는 뭔가 잘못하고 생각했다. 버그를 제기합니다. –
이 버그가 수정되었습니다. https://github.com/fsharp/fsharpx/commit/e9912d9cb68cedd723e351748c47f9fefc7bbb3d (154 줄 참조) –