Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
PA-Toolbox -- Predictive Analytics Java Toolbox
Copyright 2014-2016 Hans-Hermann Bode
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package de.h2b.java.lib.office;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
/**
* Implements methods to read Excel sheets and convert the results into suitable
* data structures.
*
* The columns of the first row are interpreted as keys. This is reflected by
* mapping a column index to its key where columns with empty keys are skipped.
*
* The remaining rows are converted to a list of maps, where each item of the
* list represents a row of the sheet, mapping the keys defined above to the
* values of the cells, respectively. Both keys and values of the map are
* strings. Note that entries of the map may be {@code null} (resulting
* from, e.g., empty cells), but their will be no entry for columns with empty
* keys; also, rows containing empty cells only will be skipped.
*
* @author h2b
*
*/
public class ExcelReader {
private List