public void saveAs(String path) throws IOException {
		if (getCounter()==0 && lastColumn<0) return;
		if (path==null || path.equals("")) {
			SaveDialog sd = new SaveDialog("Save Results", "Results", Prefs.get("options.ext", ".xls"));
			String file = sd.getFileName();
			if (file==null) return;
			path = sd.getDirectory() + file;
		}
		delimiter = path.endsWith(".csv")?',':'\t';
		PrintWriter pw = null;
		FileOutputStream fos = new FileOutputStream(path);
		BufferedOutputStream bos = new BufferedOutputStream(fos);
		pw = new PrintWriter(bos);
		boolean saveShowRowNumbers = showRowNumbers;
		if (Prefs.dontSaveRowNumbers)	
			showRowNumbers = false;
		if (!Prefs.dontSaveHeaders) {
			String headings = getColumnHeadings();
			pw.println(headings);
		}
		for (int i=0; i<getCounter(); i++)
			pw.println(getRowAsString(i));
		showRowNumbers = saveShowRowNumbers;
		pw.close();
		delimiter = '\t';
	}