コード例 #1
0
ファイル: mainC.c プロジェクト: GerHobbelt/xlslib
/*
only to test the compile and link phase: do we have 'em all?

... no, we don't, so it seems...
*/
void test_compile(void)
{
workbook *w = 0;
worksheet *s = 0;
const char *name = "";
char charbuf[5];
const unichar_t *uname = 0;
font_t *f = 0;
format_t *fmt = 0;
xf_t *xf = 0;
property_t prop = PROP_SUBJECT;
unsigned16_t i16 = 0;
unsigned32_t row = 0;
unsigned32_t col = 0;
range *r;
cell_t *c = 0;
double numval = 0.0;
format_number_t fmtnum = FMT_CURRENCY8;
halign_option_t ha = HALIGN_RIGHT;
valign_option_t va = VALIGN_BOTTOM;
txtori_option_t ori = ORI_90NOCLOCKTXT;
color_name_t *color = 0;
fill_option_t fill = FILL_HORIZ_LINES_THIN;
bool b = 0;
border_side_t side = BORDER_TOP;
border_style_t style = BORDER_DOTTED;
unsigned8_t i8 = 0;
boldness_option_t fntboldness = BOLDNESS_HALF;
underline_option_t fntunderline = UNDERLINE_SINGLE;
script_option_t fntscript = SCRIPT_SUPER;





w = xlsNewWorkbook();
xlsDeleteWorkbook(w);

s = xlsWorkbookSheet(w, name);
s = xlsWorkbookSheetW(w, uname);
s = xlsWorkbookGetSheet(w, i16);
f = xlsWorkbookFont(w, name);
fmt = xlsWorkbookFormat(w, name);
fmt = xlsWorkbookFormatW(w, uname);
xf = xlsWorkbookxFormat(w);
xf = xlsWorkbookxFormatFont(w, f);
#ifdef HAVE_ICONV
xlsWorkbookIconvInType(w, name);
#endif
xlsWorkbookProperty(w, prop, name);
xlsWorkBookWindPosition(w, i16, i16);
xlsWorkBookWindSize(w, i16, i16);
xlsWorkBookFirstTab(w, i16);
xlsWorkBookTabBarWidth(w, i16);
xlsWorkbookDump(w, name);

// Worksheet
xlsWorksheetMakeActive(s);	// Make this sheet the selected sheet
c =  xlsWorksheetFindCell(s, row, col);
xlsWorksheetMerge(s, row, col, row, col);
xlsWorksheetColwidth(s, col, i16, xf);
xlsWorksheetRowheight(s, row, i16, xf);
r = xlsWorksheetRangegroup(s, row, col, row, col);
c =  xlsWorksheetLabel(s, row, col, name, xf);
c =  xlsWorksheetLabelW(s, row, col, uname, xf);
c =  xlsWorksheetBlank(s, row, col, xf);
c =  xlsWorksheetNumberDbl(s, row, col, numval, xf);
// 536870911 >= numval >= -536870912
c =  xlsWorksheetNumberInt(s, row, col, 0, xf);
#ifndef FALSE
#define FALSE 0
#endif
c = xlsWorksheetBoolean(s, row, col, FALSE, xf);
c = xlsWorksheetError(s, row, col, XLERR_VALUE, xf);
c = xlsWorksheetNote(s, row, col, name, name, xf);
c = xlsWorksheetNoteW(s, row, col, uname, uname, xf);
//c = xlsWorksheetFormula(s, row, col, expr, xf);

// cell: xfi
xlsCellFont(c, f);
xlsCellFormat(c, fmtnum);
xlsCellFormatP(c, fmt);
xlsCellHalign(c, ha);
xlsCellValign(c, va);
xlsCellOrientation(c, ori);
xlsCellFillfgcolor(c, *color);
xlsCellFillbgcolor(c, *color);
xlsCellFillstyle(c, fill);
xlsCellLocked(c, b);
xlsCellHidden(c, b);
xlsCellWrap(c, b);
xlsCellBorderstyle(c, side, style);
xlsCellBordercolor(c, side, *color);
xlsCellBordercolorIdx(c, side, i8);
xlsCellFontname(c, name);
// cell: font
xlsCellFontheight(c, i16);
xlsCellFontbold(c, fntboldness);
xlsCellFontunderline(c, fntunderline);
xlsCellFontscript(c, fntscript);
xlsCellFontcolor(c, *color);
//xlsCellFontattr(c, i16);
xlsCellFontitalic(c, b);
xlsCellFontstrikeout(c, b);
xlsCellFontoutline(c, b);
xlsCellFontshadow(c, b);
xlsCellGetRow(c);
xlsCellGetCol(c);
xlsCellGetXFIndex(c);
xlsCellSetXF(c, xf);
// xformat
xlsXformatSetFont(xf, f);
xlsXformatGetFontIndex(xf);
xlsXformatGetFont(xf);
xlsXformatSetFormat(xf, fmtnum);
xlsXformatSetFormatP(xf, fmt);
xlsXformatGetFormatIndex(xf);
xlsXformatGetFormat(xf);
xlsXformatSetHAlign(xf, ha);
xlsXformatGetHAlign(xf);
xlsXformatSetVAlign(xf, va);
xlsXformatGetVAlign(xf);
xlsXformatSetTxtOrientation(xf, ori);
xlsXformatGetTxtOrientation(xf);
xlsXformatSetFillFGColor(xf, *color);
xlsXformatGetFillFGColorIdx(xf);
xlsXformatSetFillBGColor(xf, *color);
xlsXformatGetFillBGColorIdx(xf);
xlsXformatSetFillStyle(xf, fill);
xlsXformatGetFillStyle(xf);
xlsXformatSetLocked(xf, b);
xlsXformatIsLocked(xf);
xlsXformatSetHidden(xf, b);
xlsXformatIsHidden(xf);
xlsXformatSetWrap(xf, b);
xlsXformatIsWrap(xf);
xlsXformatSetCellMode(xf, b);
xlsXformatIsCell(xf);
xlsXformatSetBorderStyle(xf, side, style);
xlsXformatSetBorderColor(xf, side, *color);
xlsXformatSetBorderColorIdx(xf, side, i8);
xlsXformatGetBorderStyle(xf, side);
xlsXformatGetBorderColorIdx(xf, side);
//xlsXformatGetSignature(xf);

// Font
xlsFontSetName(f, name);
xlsFontGetName(f, charbuf, sizeof(charbuf));
xlsFontSetHeight(f, i16);
xlsFontGetHeight(f);
xlsFontSetBoldStyle(f, fntboldness);
xlsFontGetBoldStyle(f);
xlsFontSetUnderlineStyle(f, fntunderline);
xlsFontGetUnderlineStyle(f);
xlsFontSetScriptStyle(f, fntscript);
xlsFontGetScriptStyle(f);
xlsFontSetColor(f, *color);
xlsFontGetColorIdx(f);
xlsFontSetItalic(f, b);
xlsFontSetStrikeout(f, b);
#if defined(DEPRECATED)
xlsFontSetAttributes(f, i16);
#endif
xlsFontGetAttributes(f);
xlsFontSetOutline(f, b);
xlsFontSetShadow(f, b);
}
コード例 #2
0
ファイル: sdds2spreadsheet.c プロジェクト: epicsdeb/sdds
int main(int argc, char **argv)
{
  FILE *outfile;
  SDDS_TABLE SDDS_table;
  SDDS_LAYOUT *layout;
  COLUMN_DEFINITION *coldef;
  PARAMETER_DEFINITION *pardef;
  ARRAY_DEFINITION *arraydef;
  long list_request;
  char *input, *output;
  long i, j, i_arg, append_units, nrows, ntable;
  SCANNED_ARG *s_arg;
  char *text, *contents, *delimiter;
  long verbose=0, all=0, nvariableparms=0, excel=0, line=0;
  void *data;
  unsigned long pipeFlags;
#ifdef USE_XLS
  workbook *w;
  worksheet *ws;
#endif
  int ret;
  char sheet[256];
  char buffer[5];

  SDDS_RegisterProgramName(argv[0]);
  
  list_request = -1;
  input = output = NULL;
  append_units = 0;
  delimiter = DELIMITER;
  pipeFlags = 0;
  
  argc = scanargs(&s_arg, argc, argv);
  if (argc==1)
    bomb(NULL, USAGE);
  
  for (i_arg=1; i_arg<argc; i_arg++) {
    if (s_arg[i_arg].arg_type==OPTION) {
      switch (match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
      case SET_DELIMITER:
	if (s_arg[i_arg].n_items<2)
	  SDDS_Bomb("Invalid -delimiter syntax");
	delimiter = s_arg[i_arg].list[1];
	break;
      case SET_ALL:
	all = 1;
	break;
      case SET_EXCEL:
#ifdef USE_XLS
	excel = 1;
#else
        SDDS_Bomb("-excel option is not available becuase sdds2spreadsheet was not compiled with xlslib support");
#endif
	break;
      case SET_VERBOSE:
	verbose = 1;
	break;
      case SET_PIPE:
	if (!processPipeOption(s_arg[i_arg].list+1, 
			       s_arg[i_arg].n_items-1, &pipeFlags))
	  SDDS_Bomb("invalid -pipe syntax");
	break;
      default:
	SDDS_Bomb(strcat("Unknown option: ", s_arg[i_arg].list[0]));
	break;
      }
    }
    else {
      if (input==NULL)
	input = s_arg[i_arg].list[0];
      else if (output==NULL)
	output = s_arg[i_arg].list[0];
      else
	SDDS_Bomb("too many filenames");
    }
  }
  
  
  processFilenames("sdds2spreadsheet", &input, &output, pipeFlags, 0, NULL);
  
  if (output) {
    if (!excel) {
      outfile=fopen(output,"w");
      if(!outfile)
        SDDS_Bomb(strcat("Can't open output file ", output));
    }
  }
  else {
    if (excel) {
      SDDS_Bomb("-pipe=out and -excel options cannot be used together");
    }
    outfile = stdout;
  }
  
  if (input && !excel)
    fprintf(outfile,"Created from SDDS file: %s\n", input);
  if (!SDDS_InitializeInput(&SDDS_table, input)) {
    SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
    exit(1);
  }
  layout = &SDDS_table.layout;
  /* Description */    
  if(verbose && input) 
    fprintf(stderr, "\nfile %s is in SDDS protocol version %" PRId32 "\n", 
	    input, layout->version);

  if (!SDDS_GetDescription(&SDDS_table, &text, &contents)) 
    SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors|SDDS_EXIT_PrintErrors);
  
  if (text) 
    if (verbose) 
      fprintf(stderr, "description: %s\n", text);

  if (!excel)
    fprintf(outfile,"%s%s\n",text?text:"No description",delimiter);
  
  if (contents)
    if (verbose) 
      fprintf(stderr, "contents: %s\n", contents);

  if (!excel)
    fprintf(outfile,"%s%s\n",contents?contents:"No description",delimiter);
  
  if (layout->data_mode.mode==SDDS_ASCII) {
    if (verbose) {
      fprintf(stderr, "\ndata is ASCII with %" PRId32 " lines per row and %" PRId32 " additional header lines expected.\n",
	      layout->data_mode.lines_per_row, layout->data_mode.additional_header_lines);
      fprintf(stderr, "row counts: %s    \n",
	      layout->data_mode.no_row_counts?"no":"yes");
    }
  } 
  else if (verbose) 
    fprintf(stderr, "\ndata is binary\n");

  /* Columns */    
  if (layout->n_columns) {
    if(verbose) {
      fprintf(stderr, "\n%" PRId32 " columns of data:\n", layout->n_columns);
      fprintf(stderr, "NAME            UNITS           SYMBOL          FORMAT          TYPE    FIELD  DESCRIPTION\n");
      fprintf(stderr, "                                                                        LENGTH\n");
    }
    if (all && !excel) 
      fprintf(outfile,
	      "\nColumns%s\nName%sUnits%sSymbol%sFormat%sType%sField Length%sDescription%s\n",
	      delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, 
	      delimiter);
    for (i=0; i<layout->n_columns; i++) {
      coldef = layout->column_definition+i;
      if(verbose) 
	fprintf(stderr, "%-15s %-15s %-15s %-15s %-7s %-7" PRId32 " %s\n",
		coldef->name, coldef->units?coldef->units:"", 
                coldef->symbol?coldef->symbol:"",
		coldef->format_string?coldef->format_string:"", 
                SDDS_type_name[coldef->type-1], 
                coldef->field_length,  
		coldef->description?coldef->description:"");
      if(all && !excel) 
	fprintf(outfile,"%s%s%s%s%s%s%s%s%s%s%-7" PRId32 "%s%s%s\n",
		coldef->name, delimiter,
		coldef->units?coldef->units:"", delimiter,
		coldef->symbol?coldef->symbol:"", delimiter,
		coldef->format_string?coldef->format_string:"", delimiter,
		SDDS_type_name[coldef->type-1], delimiter,
		coldef->field_length,  delimiter,
		coldef->description?coldef->description:"", delimiter);
    }
  }
  /* Parameters */    
  if (layout->n_parameters) {
    if (verbose) {
      fprintf(stderr, "\n%" PRId32 " parameters:\n", layout->n_parameters);
      fprintf(stderr, 
	      "NAME                UNITS               SYMBOL              TYPE                DESCRIPTION\n");
    }
    if(all && !excel) 
      fprintf(outfile,"\nParameters%s\nName%sFixedValue%sUnits%sSymbol%sType%sDescription%s\n",
	      delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, delimiter);
    for (i=0; i<layout->n_parameters; i++) {
      pardef = layout->parameter_definition+i;
      if(!pardef->fixed_value) {
	nvariableparms++;
	if(!all) continue;
      }
      if(verbose) fprintf(stderr, "%-19s %-19s %-19s %-19s %s\n",
			  pardef->name, pardef->units?pardef->units:"", pardef->symbol?pardef->symbol:"", 
			  SDDS_type_name[pardef->type-1], pardef->description?pardef->description:"");
      if (!excel) {
        if(all) fprintf(outfile,"%s%s%s%s%s%s%s%s%s%s%s%s\n",
                        pardef->name, delimiter,
                        pardef->fixed_value?pardef->fixed_value:"", delimiter,
                        pardef->units?pardef->units:"", delimiter,
                        pardef->symbol?pardef->symbol:"", delimiter,
                        SDDS_type_name[pardef->type-1], delimiter,
                        pardef->description?pardef->description:"", delimiter);
        else fprintf(outfile,"%s%s%s%s%s\n",
                     pardef->name, delimiter, delimiter,
                     pardef->fixed_value?pardef->fixed_value:"", delimiter);
      }
    }
  }
  /* Arrays */    
  if (layout->n_arrays && all) {
    if(verbose) {
      fprintf(stderr, "\n%" PRId32 " arrays of data:\n", layout->n_arrays);
      fprintf(stderr, "NAME            UNITS           SYMBOL"
	      "          FORMAT  TYPE            FIELD   GROUP           DESCRIPTION\n");
      fprintf(stderr, "                                                                        LENGTH  NAME\n");
    }
    if (!excel) {
      fprintf(outfile,"\nArrays%s\nName%sUnits%sSymbol%sFormat%sType%sField Length%sGroup Name%sDescription%s\n", delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, delimiter, delimiter);
    }
    for (i=0; i<layout->n_arrays; i++) {
      arraydef = layout->array_definition+i;
      if(verbose) fprintf(stderr, "%-15s %-15s %-15s %-7s %-8s*^%-5" PRId32 " %-7" PRId32 " %-15s %s\n",
			  arraydef->name, arraydef->units, arraydef->symbol,
			  arraydef->format_string, SDDS_type_name[arraydef->type-1], arraydef->dimensions,
			  arraydef->field_length,  arraydef->group_name, arraydef->description);
      if (!excel) {
        fprintf(outfile,"%s%s%s%s%s%s%s%s%s*^%-5" PRId32 "%s%-7" PRId32 "%s%s%s%s%s\n",
                arraydef->name, delimiter,
                arraydef->units, delimiter,
                arraydef->symbol, delimiter,
                arraydef->format_string, delimiter,
                SDDS_type_name[arraydef->type-1], arraydef->dimensions, delimiter,
                arraydef->field_length,  delimiter,
                arraydef->group_name, delimiter,
                arraydef->description, delimiter);
      }
    }
  }
  /* Associates */    
  /*
    if (layout->n_associates && all) {
    if(verbose) {
            fprintf(stderr, "\n%ld associates:\n", layout->n_associates);
            fprintf(stderr, "SDDS  FILENAME            PATH                          CONTENTS            DESCRIPTION\n");
            }
        fprintf(outfile,"\nAssociates%s\nType%sFilename%sPath%sContents%sDescription%s\n",
	  delimiter, delimiter, delimiter, delimiter, delimiter, delimiter);
	for (i=0; i<layout->n_associates; i++)
          if(verbose) fprintf(stderr, "%-5s %-19s %-29s %-19s %s\n",
	    layout->associate_definition[i].sdds?"SDDS":"Non-SDDS",
	    layout->associate_definition[i].filename, layout->associate_definition[i].path,
	    layout->associate_definition[i].contents, layout->associate_definition[i].description);
	  fprintf(outfile,"%s%s%s%s%s%s%s%s%s%s\n",
	    layout->associate_definition[i].sdds?"yes":"no", delimiter,
	    layout->associate_definition[i].filename, delimiter,
	    layout->associate_definition[i].path, delimiter,
	    layout->associate_definition[i].contents, delimiter,
	    layout->associate_definition[i].description, delimiter);
    }
*/

#ifdef USE_XLS
  w = xlsNewWorkbook();
#ifdef __APPLE__
  xlsWorkbookIconvInType(w, "UCS-4-INTERNAL");
#endif
#endif
/* Process tables */    
  while ((ntable=SDDS_ReadTable(&SDDS_table))>0) {
    line=0;
#ifdef USE_XLS
    if (excel) {
      sprintf(sheet, "Sheet%d", ntable);
      ws = xlsWorkbookSheet(w, sheet);
    } else
      fprintf(outfile,"\nTable %ld\n",ntable);
#else
    fprintf(outfile,"\nTable %ld\n",ntable);  
#endif
    /* Variable parameters */
    if (nvariableparms) {
      for (i=0; i<layout->n_parameters; i++) {
	pardef = layout->parameter_definition+i;
	if(pardef->fixed_value) continue;
	if (!(data=SDDS_GetParameter(&SDDS_table, pardef->name, NULL))) {
	  SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
	  exit(1);
	}
#ifdef USE_XLS
        if (excel) {
          xlsWorksheetLabel(ws, line, 0, pardef->name, NULL);
          switch(pardef->type) {
          case SDDS_DOUBLE:
            xlsWorksheetNumberDbl(ws, line, 1, *((double*)data), NULL);
            break;
          case SDDS_FLOAT:
            xlsWorksheetNumberDbl(ws, line, 1, *((float*)data), NULL);  
            break;
          case SDDS_ULONG:
            xlsWorksheetNumberInt(ws, line, 1, *((uint32_t*)data), NULL);  
            break;
          case SDDS_LONG:
            xlsWorksheetNumberInt(ws, line, 1, *((int32_t*)data), NULL);  
            break;
          case SDDS_USHORT:
            xlsWorksheetNumberInt(ws, line, 1, *((unsigned short*)data), NULL);  
            break;
          case SDDS_SHORT:
            xlsWorksheetNumberInt(ws, line, 1, *((short*)data), NULL);  
            break;
          case SDDS_STRING:
            xlsWorksheetLabel(ws, line, 1, *((char**)data), NULL);
            break;
          case SDDS_CHARACTER:
            sprintf(buffer, "%c", *((char*)data));
            xlsWorksheetLabel(ws, line, 1, buffer, NULL);
            break;
          default:
            break;
          }

          line++;
        } else {
#endif
          fprintf(outfile,"%s%s%s",pardef->name,delimiter,delimiter);
          SDDS_PrintTypedValue(data, 0, pardef->type, NULL, outfile, 0);
          fprintf(outfile,"%s\n",delimiter);
#ifdef USE_XLS
        }
#endif
      }
      line++;
    }
    /* Columns */
    if (layout->n_columns) {
      SDDS_SetColumnFlags(&SDDS_table, 1);
      SDDS_SetRowFlags(&SDDS_table, 1);
      if ((nrows=SDDS_CountRowsOfInterest(&SDDS_table))<0) {
	SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
	exit(1);
      }
      for (i=0; i<layout->n_columns; i++) {
	coldef = layout->column_definition+i;
#ifdef USE_XLS
        if (excel) {
          xlsWorksheetLabel(ws, line, i, coldef->name, NULL);
        }
        else
          fprintf(outfile,"%s%s",coldef->name,delimiter);
#else
        fprintf(outfile,"%s%s",coldef->name,delimiter);
#endif
      }
      line++;
      if (!excel)
        fprintf(outfile,"\n");
      if (nrows) {
	for (j=0; j<nrows; j++) {
	  for (i=0; i<layout->n_columns; i++) {
	    coldef = layout->column_definition+i;
	    if (!(data=SDDS_GetValue(&SDDS_table, coldef->name,j,NULL))) {
	      SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
	      exit(1);
	    }
#ifdef USE_XLS
            if (excel) {
              switch(coldef->type) {
              case SDDS_DOUBLE:
                xlsWorksheetNumberDbl(ws, line, i, *((double*)data), NULL);  
                break;
              case SDDS_FLOAT:
                xlsWorksheetNumberDbl(ws, line, i, *((float*)data), NULL);  
                break;
              case SDDS_ULONG:
                xlsWorksheetNumberInt(ws, line, i, *((uint32_t*)data), NULL);  
                break;
              case SDDS_LONG:
                xlsWorksheetNumberInt(ws, line, i, *((int32_t*)data), NULL);  
                break;
              case SDDS_USHORT:
                xlsWorksheetNumberInt(ws, line, i, *((unsigned short*)data), NULL);  
                break;
              case SDDS_SHORT:
                xlsWorksheetNumberInt(ws, line, i, *((short*)data), NULL);  
                break;
              case SDDS_STRING:
                xlsWorksheetLabel(ws, line, i, *((char**)data), NULL);
                break;
              case SDDS_CHARACTER:
                sprintf(buffer, "%c", *((char*)data));
                xlsWorksheetLabel(ws, line, i, buffer, NULL);
                break;
              default:
                break;
              }
            } else {
#endif
              switch(coldef->type) {
              case SDDS_DOUBLE:
                fprintf(outfile, "%.*g", DBL_DIG, *((double*)data));
                break;
              case SDDS_FLOAT:
                fprintf(outfile, "%.*g", FLT_DIG, *((float*)data));
                break;
              default:
                SDDS_PrintTypedValue(data, 0, coldef->type, NULL, outfile, 0);
                break;
              }
              fprintf(outfile,delimiter);
#ifdef USE_XLS
            }
#endif
	  }
          if (!excel)
            fprintf(outfile,"\n");
          line++;
	}
      }
    }
  }
#ifdef USE_XLS
  ret = xlsWorkbookDump(w, output);
  xlsDeleteWorkbook(w);
#endif

  /*	
	QUIT:
  */
  fflush(stdout);
  if (!SDDS_Terminate(&SDDS_table)) {
    SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors);
    exit(1);
  }
  return(0);
}
コード例 #3
0
ファイル: mainC.c プロジェクト: GerHobbelt/xlslib
int main(int argc, char *argv[]) 
{
	workbook *w;
	worksheet *ws;
	int ret;
	char check[40], *checkP = check;
	char fileName[128];
	
	fileName[0] = 0;
	
	// Used for internal testing
	if(argc == 2) {
#ifdef _X_DEBUG_
		chdir(argv[1]);
#endif
		strcpy(fileName, argv[1]);
		strcat(fileName, "/");		
	}
	strcat(fileName, "mainC.md5");
	
	{
		FILE *fp = fopen(fileName, "r");
		if(fp) {
			fscanf(fp, "%s", checkP);
			fclose(fp);
		} else {
			strcpy(checkP, "00000000000000000000000000000000");
		}
		//printf("MD5 = %s\n", checkP);
	}

	xlslib_register_assert_reporter(&my_xlslib_assertion_reporter);

	w = xlsNewWorkbook();
	ws = xlsWorkbookSheet(w, "xlslib C");
#ifdef __APPLE__
	xlsWorkbookIconvInType(w, "UCS-4-INTERNAL");
#endif
	xlsWorksheetNumberDbl(ws, (unsigned16_t)1, (unsigned16_t)1, 1.0, NULL);  
	xlsWorksheetNumberDbl(ws, (unsigned16_t)2, (unsigned16_t)1, 2.0, NULL);
	xlsWorksheetNumberDbl(ws, (unsigned16_t)3, (unsigned16_t)1, 3.0, NULL);
	xlsWorksheetLabel(ws, 4, 1, "ASCII text", NULL);
	writeUnicodeLabel(ws, 5, 1);
	ret = xlsWorkbookDump(w, "testC.xls");

	// printf("    # saved it ret=%d errno=%s\n", ret, strerror(errno));

	xlsDeleteWorkbook(w);

	if (ret != NO_ERRORS)
	{
		fprintf(stderr, "%s failed: I/O failure %d.\n", argv[0], ret);
		return EXIT_FAILURE;
	}
	if ((checkP = check_file("testC.xls", checkP)))
	{
		fprintf(stderr, "%s failed: MD5 of generated XLS mismatch or I/O failure.\n", argv[0]);

		if(argc == 2)
		{
			FILE *fp = fopen(fileName, "w");
			if(fp) {
				fprintf(fp, "%s\n", checkP);
				printf("UPDATE MD5 = %s\n", checkP);
				fclose(fp);
			} else {
				printf("FAILED TO WRITE MD5\n");
			}
		}
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;
}