-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or request
Description
For example, this causes an error:
open System.Data
open FsExcel
open ClosedXML.Excel
let table = new DataTable("Fruits")
let id = new DataColumn()
id.ColumnName <- "Id"
table.Columns.Add(id)
let name = new DataColumn()
name.ColumnName <- "Name"
table.Columns.Add(name)
let averageWeightG = new DataColumn()
averageWeightG.ColumnName <- "AverageWeightG"
table.Columns.Add(averageWeightG)
for id, name, averageWeightG in [1, "Apple", 100; 2, "Pear", 110; 3, "Banana", 120] do
let row = table.NewRow()
row["Id"] <- id
row["Name"] <- name
row["AverageWeightG"] <- averageWeightG
table.Rows.Add(row)
let cellStyleHorizontal index name =
if index = 0 then
[
Border(Border.Bottom XLBorderStyleValues.Medium)
FontEmphasis Bold
]
elif name = "Fees" then
[ FormatCode "$0.00" ]
else
[]
seq {for row in table.Rows -> row}
|> Table.fromSeq Table.Direction.Horizontal cellStyleHorizontal
|> fun cells -> cells @ [ AutoFit All ]
|> Render.AsFile (Path.Combine(savePath, "RecordSequenceVertical.xlsx"))Error: System.ArgumentException: Type 'System.Data.DataRow' is not an F# record type. (Parameter 'recordType')
at Microsoft.FSharp.Reflection.Impl.checkRecordType(String argName, Type recordType, BindingFlags bindingFlags) in D:\a_work\1\s\src\fsharp\FSharp.Core\reflect.fs:line 849
at FsExcel.Table.Fields.serializable@16.Invoke(Type _arg1)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at FsExcel.Table.Fields.serializable(Type t)
at FsExcel.Table.Cells.header[T](FSharpFunc2 getCellStyle) at FsExcel.Table.fromSeq[T](Direction direction, FSharpFunc2 getCellStyle, IEnumerable`1 xs)
at <StartupCode$FSI_0025>.$FSI_0025.main@()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request