apache-poi

Exception while using Apache POI on a JSP

给你一囗甜甜゛ 提交于 2019-12-12 01:48:36
问题 I'm trying to implement Apache POI to display the data on an Excel file into some inputs on my web page. I'm getting this exception: exception org.apache.jasper.JasperException: Unable to compile class for JSP org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:677) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service

right to left with apache poi

亡梦爱人 提交于 2019-12-12 01:33:48
问题 i'm using apache poi to modify some existing rtf files and return a copy to the client in a web application the issu with me is when i try to replacesome text and insert another wich is in arabic instead. here my code : FileInputStream in = new FileInputStream(mypath); POIFSFileSystem fs = new POIFSFileSystem(in); HWPFDocument doc = new HWPFDocument(fs); Range r = doc.getRange(); r.replaceText("<matricule>"," "+agent.getMatriculeAgent()); r.replaceText("<cin>"," "+agent.getCin());

How do I read the cell contents using apache poi for xlsx type of excel file?

我怕爱的太早我们不能终老 提交于 2019-12-12 01:29:08
问题 It seems I'm in a bit of a pickle, I read various topics about read xls files with hssf but I can't seem to find good xssf tutorials and it's really hard since they have different statements. My code is supposed to read the row 2, column 2 but I get a "getContents() is undefined for the type XSSFComment" error My code goes something like: import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache

java apache poi (part 1)

对着背影说爱祢 提交于 2019-12-12 01:27:17
问题 excel file (staff.xls) ID name 1 ali 2 abu 3 ahmad java code FileInputStream inputFile = new FileInputStream("staff.xls"); XSSFWorkbook workbook = new XSSFWorkbook(inputFile); XSSFSheet spreadsheet = workbook.getSheetAt(0); XSSFRow row; Cell cell; Iterator<Row> rowIterator = spreadsheet.iterator(); while(rowIterator.hasNext()){ row = (XSSFRow)rowIterator.next(); Iterator<Cell> cellIterator = row.cellIterator(); while(cellIterator.hasNext()){ cell = cellIterator.next(); cell.setCellType(Cell

ERROR : Caused by: java.lang.IllegalArgumentException: Relationship null doesn't start with this part /ppt/slides/slide3.xml

笑着哭i 提交于 2019-12-12 01:26:48
问题 I'm working with apache poi xslf to export ppt file. First, I have a template set with 3 slides : title slide, summary slide, and third slide I duplicate the 3rd slide (i have it as a template) in order to copy many data/graphics as I have in database. So in order to do that : XMLSlideShow slideShow = new XMLSlideShow(dlfile.getContentStream()); XSLFSlide[] slides = slideShow.getSlides(); XSLFSlide createdSlide = slideShow.createSlide(slides[2].getSlideLayout()); //get content from slide to

Dynamically add External (Cross-Workbook) references

时光总嘲笑我的痴心妄想 提交于 2019-12-12 00:54:08
问题 In our project, we have different versions of excelsheets which reference each other: C:\V1\Sample.xls //no references C:\V2\Sample.xls //references V1 C:\V3\Sample.xls //references V2 Example of a cell value: =MID('C:\V1\[Sample.xls]Sheet1'!$AB2;21;1) Now I want to evaluate formulas of V3 using apache POI, I found the following example here // Create a FormulaEvaluator to use FormulaEvaluator mainWorkbookEvaluator = workbook.getCreationHelper().createFormulaEvaluator(); // Track the workbook

How to get hyperlink address from a cell in excel by using java?

雨燕双飞 提交于 2019-12-12 00:45:02
问题 I know how to use JavaExcelApi (jxl) or Apache POI to read string information of a cell in an excel file by writing some java code. But now I got a problem: A cell contains a string with a hyperlink on it. I can read the string in this cell, but I don't know how to read the hyperlink address through java. 回答1: The method you're looking for is Cell.getHyperlink(), which returns either null (cell has no hyperlink) or a Hyperlink object If you wanted to fetch the hyperlink URL of cell B2 of test

I want to extract and display Json array data into Excel sheet

风格不统一 提交于 2019-12-11 23:55:10
问题 I have one activity called task list.this task list contains json array I have one button now I want to export the task list into Excel sheet on button click For Creating Excel sheet I have used poi-3.7.jar my code for Excel sheet: public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.param11: saveExcelFile(this,"myexcel.xls"); break; } } private static boolean saveExcelFile(Context context, String fileName) { // check if available and not read only

DataDriven testing with TestNG using Apache POI in Selenium WebDriver

家住魔仙堡 提交于 2019-12-11 21:53:08
问题 I am new to TestNG framework. Please guide how to parameterise the test cases using Apache POI(Excel). I have a code to read from second row from Excel. public class spreadData { private transient Collection data = null; public spreadData(final InputStream excelInputStream) throws IOException { this.data = loadFromSpreadsheet(excelInputStream); } public Collection getData() { return data; } private Collection loadFromSpreadsheet(final InputStream excelFile) throws IOException { HSSFWorkbook

Getting java.lang.IllegalArgumentException: The end (7905) must not be before the start (15721) Exception while reading word document

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 21:07:44
问题 I am parsing Microsoft Word documents. I have imported Apache poi jar to read the Word document. I want to get the headings present in the Word document. I have given the size of the headings to get that filtered. public void try1(POIFSFileSystem filestream) throws Exception { HWPFDocument doc = new HWPFDocument (filestream); WordExtractor we = new WordExtractor(doc); Range range = doc.getRange(); String[] paragraphs = we.getParagraphText(); for (int i = 0; i < paragraphs.length; i++) {