apache-poi

How to integrate Liferay DXP with Apache POI?

杀马特。学长 韩版系。学妹 提交于 2019-12-21 22:53:52
问题 I'm trying to integrate Apache POI in Liferay DXP(OSGi) , but unable to resolve dependencies with POI 3.17 version in gradle project. I've created standalone project with below JAR's : poi-3.17.jar poi-ooxml-3.17.jar poi-ooxml-schemas-3.17.jar xmlbeans-2.6.0.jar commons-collections4-4.1.jar Also, I've added below gradle dependencies added in build.gradle compile group: 'org.apache.poi', name: 'poi', version: '3.17' compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17' compile

how to make cell as read-only in excel using apachi-POI

跟風遠走 提交于 2019-12-21 21:34:00
问题 i have a drop down list contains some options, and for example two cells. what i need is regarding the selected option turn one of the cells to editable and the other to read-only and vise-versa. FileOutputStream fos; try { fos = new FileOutputStream("D:\\POIXls.xls"); Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("new Sheet"); DataValidationHelper dvHelper = sheet.getDataValidationHelper(); DataValidationConstraint dvConstraint = dvHelper

Updating Excel sheet values based on a csv sheet with Apache POI

余生长醉 提交于 2019-12-21 21:03:57
问题 I am still new to java. I am having a bit problems with the java syntax. My Program should do the following procedure: 1) It takes a csv file as an input. 2) It takes an excel file as an input. 3) It should iterate over the first columns of the two files where the dates are written. 4) Update the excel file by adding the information from the csv sheet and save its changes. I have a https://onedrive.live.com/?cid=24b4fceb4f4e4098&id=24B4FCEB4F4E4098%213018&authkey=%21AKKzaZsJ5pkd5NE where I

Chinese characters converted to squares when using APACHE POI to convert PPT to Image

北慕城南 提交于 2019-12-21 20:59:13
问题 I got a problem when I try to use Apache POI project to convert my PPT to Images. My code as follows: FileInputStream is = new FileInputStream("test.ppt"); SlideShow ppt = new SlideShow(is); is.close(); Dimension pgsize = ppt.getPageSize(); Slide[] slide = ppt.getSlides(); for (int i = 0; i < slide.length; i++) { BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); //clear the drawing area graphics.setPaint

How to get the formula cell value(data) using apache poi 3.1

余生长醉 提交于 2019-12-21 20:26:15
问题 I am using Apache poi-3.1-FINAL-20080629 in my application. here, I have one problem using formula... My Cell has formula(sheet2!C10) and the data inside this cell is String type (e.g $3,456)...How to access that cell also want to display the formula. My code Looks like: HSSFWorkbook wb = new HSSFWorkbook(file); HSSFSheet sheet = wb.getSheetAt(0); HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb); Iterator rows = sheet.rowIterator(); while (rows.hasNext()) { HSSFRow row =

How to create java poi bar chart combining two bars value like given image?

丶灬走出姿态 提交于 2019-12-21 20:13:14
问题 I want to create bar chart something like this with java poi , (Has two set of bars),Till now could find only for single type of bars, can anyone help me out with any reference?? Thanks. 回答1: Not clear from your question what code for creating bar chart using apache poi you have found already. Until now apache poi does only supporting line chart and scatter chart but not bar chart directly. So creating a bar chart is only possible using the underlaying low level objects. For a reference do

Apache POI - reading modifies excel file

房东的猫 提交于 2019-12-21 17:49:58
问题 Whenever I open a excel file using the Apatche POI the file gets modified, even though I'm just reading the file and not making any modification. Take for instance such test code. public class ApachePoiTest { @Test public void readingShouldNotModifyFile() throws Exception { final File testFile = new File("C:/work/src/test/resources/Book2.xlsx"); final byte[] originalChecksum = calculateChecksum(testFile); Assert.assertTrue("Calculating checksum modified file", MessageDigest.isEqual

Apache POI default style for workbook

对着背影说爱祢 提交于 2019-12-21 17:17:03
问题 I am trying to change the default cell style for an entire Excel workbook ( XSSF ) using Apache POI . This should be applied to new cells a user might create (after the workbook has been saved by POI ). I am trying to do this by calling workbook.getCellStyleAt(0) -- which I understand to be the default style for the workbook -- and then by modifying this style to what I want for the new default. This works when I read in an existing XSLX file (a "template" file) and modify the default style.

Format number with thousands separator in Excel using Apache POI

两盒软妹~` 提交于 2019-12-21 11:34:33
问题 I want to format some number cells, with a comma as thousands separator. For example: 12 -> 12 1200 -> 1,200 12000 -> 12,000 12000000 -> 12,000,000 120000000 -> 120,000,000 I have the following code. What should I use as formatStr ? Is there an easy way? Or do I have to detect the number of zeros in order to produce something like this #,###,### ? String formatStr = ""; HSSFCellStyle style = workbook.createCellStyle(); HSSFDataFormat format = workbook.createDataFormat(); style.setDataFormat

How to format the text in a XWPFTable in Apache POI

这一生的挚爱 提交于 2019-12-21 11:33:44
问题 I have created a XWPFTable in word using Apache POI. Now the table is coming out properly with text in the column. Now I want to format the text in the table along with size, font etc. How can I do that? What I am seeing is that every trick is associated with the run option. But what I want is in TableRow . See what I have done so far: XWPFTable tableTwo = document.createTable(); XWPFTableRow tableTwoRowOne = tableTwo.getRow(0); tableTwo.getCTTbl().getTblPr().unsetTblBorders(); tableTwoRowOne