Révision 2238

tmp/org.txm.libs.msoffice/src/org/txm/libs/msoffice/ReadExcel.java (revision 2238)
4 4
import java.util.ArrayList;
5 5

  
6 6
import org.apache.poi.ss.usermodel.Cell;
7
import org.apache.poi.ss.usermodel.CellType;
8 7
import org.apache.poi.ss.usermodel.Row;
9 8
import org.apache.poi.ss.usermodel.Sheet;
10 9
import org.apache.poi.ss.usermodel.Workbook;
......
52 51

  
53 52
			ArrayList<String> headers = new ArrayList<String>();
54 53
			for (int it = 0 ; it < colMax; it++) {
55
				headers.add(firstRow.getCell(it).getStringCellValue().replaceAll("\n", ";"));
54
				headers.add(firstRow.getCell(it).getStringCellValue());
56 55
			}
57 56

  
58 57
			for (int rowIndex = 0 ; rowIndex < nRows ; rowIndex++) {
......
62 61
				for (int colIndex = 0 ; colIndex < colMax ; colIndex++) {
63 62
					Cell cell = row.getCell(colIndex);
64 63
					if (cell != null) {
65
						String value = cellToString(cell).replaceAll("\n", ";").trim();
64
						String value = cellToString(cell).trim();
66 65
						dataLine.add(value);
67 66
					} else {
68 67
						dataLine.add("");
tmp/org.txm.libs.office/src/org/txm/libs/office/ReadODS.java (revision 2238)
35 35

  
36 36
		List<Row> rows = table.getRowList();
37 37
		ArrayList<String> cols = new ArrayList<String>();
38
		for (int i = 0 ; i < 4 ; i++) {
38
		int ncolumns = rows.get(0).getCellCount();
39
		for (int i = 0 ; i < ncolumns ; i++) {
39 40
			cols.add(rows.get(0).getCellByIndex(i).getStringValue());
40 41
		}
41 42

  
......
45 46
			HashMap<String, String> dataline = new HashMap<String, String>();
46 47
			data.add(dataline);
47 48

  
48
			for (int j = 0 ; j < 4 ; j++) {
49
			for (int j = 0 ; j < ncolumns ; j++) {
49 50
				String cell = row.getCellByIndex(j).getDisplayText();
50 51
				if (cell == null) {
51 52
					dataline.put(cols.get(j), "");
......
112 113
				if (cell == null) {
113 114
					dataline.add("");
114 115
				} else {
115
					dataline.add(cell.replaceAll("\n", ";").trim());
116
					dataline.add(cell.trim());
116 117
				}
117 118
			}
118 119
		}

Formats disponibles : Unified diff