[Solved] Merge two excel into the third excel using java apache poi concept . And while combining the data it should add the data from left to right [closed]

Merge two excel into the third excel using java apache poi concept . And while combining the data it should add the data from left to right [closed] solved Merge two excel into the third excel using java apache poi concept . And while combining the data it should add the data from left to … Read more

[Solved] Reading Specific rows of an excel [closed]

You should try reading the documentation that comes with Apache POI! Taken straight from there: // Decide which rows to process int rowStart = Math.min(1, sheet.getFirstRowNum()); // 0 based not 1 based rows int rowEnd = Math.max(12, sheet.getLastRowNum()); for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) { Row r = sheet.getRow(rowNum); int lastColumn = … Read more

[Solved] Insert a row at the end of an Excel file without it’s old data

In general you can’t update a spreadsheet inline, or the API doesn’t work nicely anyway. But, this is how you can modify an existing spreadsheet and overwrite the old workbook with the changed workbook. import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; 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; public class ModifySheet { public … Read more

[Solved] How to read doc file using Poi?

You are trying to open a .docx file (XWPF) with code for .doc (HWPF) files. You can use XWPFWordExtractor for .docx files. There is an ExtractorFactory which you can use to let POI decide which of these applies and uses the correct class to open the file, however you can then not iterate by page … Read more

[Solved] What does the statement Object[][] data = new Object [][] mean?

In this statement Object[][] data = new Object[sheet.getLastRowNum()][sheet.getRow(0).getLastCellNum()]; It is creating an array of references to arrays of references to Objects. The first array is for rows and the leaf arrays are for column values. In reality, only String objects are added so I would write it like this. int rows = sheet.getLastRowNum(); int columns … Read more

[Solved] Retrieve the data from DB and store each Resultset in a excel sheet [closed]

i got this from someone else but figured it could be applied to your situation as well. try { Class.forName(“driverName”); //driver name Connection con = DriverManager.getConnection(“url”, “user”, “pass”); Statement st = con.createStatement(); ResultSet rs = st.executeQuery(“Select * from tablename”); //table you want to get information from HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(“sheetName”); … Read more