apache-poi

How to identify a cell is blank or null or empty while reading a excel file

五迷三道 提交于 2019-12-31 05:58:04
问题 I read a excel file to pass the input for some data fields. But when I run the program, some cell values are returning as null, some as blank.Physically when I open the excel file no value is available in the cell. How can I identify manually an excel cell is null or blank. For some scenarios I need to pass the blank values to the fields. If the cell is null I cannot pass the values to the fields. Guide me to reach out. Code: public static void readAllData() throws IOException{ Object result

Apache POI 3.13 Offline/Offset elements for a .doc

删除回忆录丶 提交于 2019-12-31 05:29:28
问题 So basically I have a requirement to validate a generated .doc when some content/ element Paragraph or Table pass to another page, and if some element/content it's alone on the other page I need to take another element/content and put it with the alone element/content public void investigarDoc(XWPFDocument doc){ try { creacionDeFooter(doc);//FOOTER CREATION METHOD XWPFParagraph cuerpoObservaciones = doc.createParagraph(); //PARAGRAPH 1 cuerpoObservaciones.setAlignment(ParagraphAlignment

How to modify a large Excel file when memory is an issue

此生再无相见时 提交于 2019-12-31 04:55:07
问题 As the title states, I have a large Excel file (>200 sheets) that I need to add data to. I do not want to create new cells, I only want to modify existing ones. I tried using Apache Poi but my application runs out of memory even with Xms and Xmx set to 8g. The only option for low-memory writing is seemingly with SXSSF. The problem is that it only works for creating new cells and does not allow modifying existing ones. I also tried using the event API in order to process the sheet's XML, but

Error while creating validation dropdown in spreadsheet using ColdFusion

对着背影说爱祢 提交于 2019-12-31 04:55:06
问题 I am just creating a validation dropdown in a spreadsheet, from a database query, using ColdFusion. But I am getting the following error "string literals in formulas can't be bigger then 255 character ASCII" Can any one please help to rectify this as I need this functionality urgently. <cfset pop_array = ArrayNew(1)> <cfset provider_name_array = ArrayNew(1)> <h1>Hello</h1> <cfquery name="qryGetPOP" datasource="webalc"> select distinct center_code from alc_pop<!--- where rownum<=10 ---> <

Read Rows Sequentially, but On Demand

岁酱吖の 提交于 2019-12-31 04:08:07
问题 I need to iterate through an Excel spreadsheet row by row, but not all at once. I want to keep a stream open to the spreadsheet, and then pass that object along to another method. This method will ask for the next row of data from time to time. This method is already established, so I can't change it. I tried doing this initially with XSSFWorkbook , which worked really well, until I ran out of memory on real data. Then I tried switching to the SAX parser, using XSSFSheetXMLHandler , with a

Java Apache POI read Word (.doc) file and get named styles used

核能气质少年 提交于 2019-12-31 03:52:06
问题 I am trying to read a Microsoft Word 2003 Document (.doc) using poi-scratchpad-3.8 (HWPF). I need to either read the file word by word, or character by character. Either way is fine for what I need. Once I have read either a character or word, I need to get the style name that is applied to the word/character. So, the question is, how do I get the style name used for a word or character when reading the .doc file? EDIT I am adding the code that I used to attempt this. If anyone wants to

How can I change charts generated by apache poi to not use smoothed lines and show empty cells as gaps?

℡╲_俬逩灬. 提交于 2019-12-31 02:37:27
问题 I am using POI 3.12-beta1 and have code that creates a line chart with multiple datasets and named series in the legend. However, the default settings for line charts in poi generate a line that has been smoothed over the data points. Empty values are also being plotted as 0, but we want the lines to stop at the first column where there is an empty cell. I can go into the chart properties once it is rendered in an xlsx file and change these settings, but we need to have the xlsx rendered with

Autowidth is not working for merged columns

不问归期 提交于 2019-12-30 19:56:08
问题 { row=sheet.createRow(0); cell=row.createCell(0); cell.setCellValue("header"); cell=row.createCell(1); sheet.addMergedRegion(new CellRangeAddress(0,0,0,1)); row=sheet.createRow(1); cell=row.createCell(0); cell.setCellValue("Keys"); cell=row.createCell(1); cell=row.setCellValue("Values"); row=sheet.createRow(2); cell=row.createCell(0); cell.setCellValue("No data"); cell=row.createCell(1); sheet.addMergedRegion(new CellRangeAddress(1,1,0,1); sheet.autoSizeColumn(0); } autosize is working when I

How to resize a chart using XSSF (Apache POI 3.8)?

南楼画角 提交于 2019-12-30 12:36:35
问题 I am wondering whether there is a way to resize a chart using Apache POI (XSSF). Currently I am using an Excel template, which has a chart that changes when more data is inserted using namedRanges. Everything works fine, the only troubles I'm facing are: The chart always stays the same size, so if there are more entries, it gets cluttered making the chart kind of useless. I am using dates, but I am not able to represent the date as day/month(17/10) on the chart. Basically instead of 04/01

Always show two decimal points in excel cells using Apache poi

非 Y 不嫁゛ 提交于 2019-12-30 06:00:15
问题 For example, XSSFCellStyle style=(XSSFCellStyle) workbook.createCellStyle(); style.setDataFormat(workbook.createDataFormat().getFormat("#.##")); productCell.setCellValue(12.4); productCell.setCellType(Cell.CELL_TYPE_NUMERIC); productCell.setCellStyle(style); This displays 12.4 in the specified cell. It should be 12.40 . The value 12 is displayed as 12. which is quite unnecessary. If the value is 0 then, it displays a dot . . It should always display two decimal digits - 0.00 , in this case