C Library struct: typedef struct lxw_conditional_format { uint8_t type; uint8_t criteria; double value; lxw_format *format; } Run
Nim object: lxw_conditional_format* = ref object `type`* :lxw_conditional_format_types criteria* :lxw_conditional_criteria value* :cdouble format* :lxw_formatPtr # C function below # lxw_error worksheet_conditional_format_range(lxw_worksheet *worksheet, # lxw_row_t first_row, # lxw_col_t first_col, # lxw_row_t last_row, # lxw_col_t last_col, # lxw_conditional_format # *conditional_format); proc conditional_format_range*(worksheet :lxw_worksheetPtr, first_row :lxw_row_t, first_col :lxw_col_t, last_row :lxw_row_t, last_col :lxw_col_t, conditional_format :ptr lxw_conditional_format) :lxw_error {.importc:"worksheet_conditional_format_range",discardable.} Run The C struct says uint8 for the type and criteria fields, but it takes an enum that corresponds to those numbers. My implementation: var redFmt = workbook.add_format() redFmt.set_bg_color(0xFFC7CE) redFmt.set_fg_color(0x9C0006) var redCFmt = lxw_conditional_format() redCFmt.kind = LXW_CONDITIONAL_TYPE_CELL redCFmt.criteria = LXW_CONDITIONAL_CRITERIA_LESS_THAN redCFmt.value = 0 redCFmt.format = redFmt echo outputSheet.conditional_format_range(12,16, 19,18,redCFmt.addr) Run I get an error called "parameter validation error", also saying "invalid type value".